Creating a mesh by cutting several meshes using GMSH

I would like to create a circular domain with two holes in it. I used this code

import gmsh
from mpi4py import MPI
from dolfinx.io import gmshio

gmsh.initialize()
gmsh.clear()

markerId = 1
disk = gmsh.model.occ.addDisk(0, 0, 0, 5, 5)
hole1 = gmsh.model.occ.addDisk(0, 0, 0, 1, 1)
membrane1 = gmsh.model.occ.cut([(2, disk)], [(2, hole1)])
hole2 = gmsh.model.occ.addDisk(2, 2, 0, 1, 1)
membrane = gmsh.model.occ.cut([(2, membrane1)], [(2, hole2)])

gmsh.model.occ.synchronize()

volumes = gmsh.model.getEntities(dim=2)
assert(volumes == membrane[0])
membrane_marker = 11

gdim = 2
gmsh.model.addPhysicalGroup(volumes[0][0], [volumes[0][1]], membrane_marker)

meshSize = 1
gmsh.option.setNumber("Mesh.CharacteristicLengthMin",meshSize)
gmsh.option.setNumber("Mesh.CharacteristicLengthMax",meshSize)
gmsh.model.mesh.generate(gdim)

gmsh_model_rank = 0
mesh_comm = MPI.COMM_WORLD
domain, cell_markers, facet_markers = gmshio.model_to_mesh(gmsh.model, mesh_comm, gmsh_model_rank, gdim=gdim)
gmsh.finalize()

but got the following error:

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (1, 2) + inhomogeneous part.

When I use the same code for only one hole everything works just fine. What did I do wrong?

Make sure your model is valid, e.g.

...
gmsh.model.occ.synchronize()
gmsh.fltk.run()

See the gmsh tutorial: Gmsh 4.11.1.

Consider contacting the gmsh community for help with gmsh.