How to catch the error "Invalid rank, error stack"

,

Hello, when I use the following code to convert the gmsh model to mesh,

mesh, subdomains, boundaries = dolfinx.io.gmshio.model_to_mesh(model, comm=mpi4py.MPI.COMM_WORLD, rank=0, gdim=2)

sometimes it will occur the following error and the program is terminated.

Invalid rank, error stack:
internal_Issend(60788): MPI_Issend(buf=0x55d4dfb364b1, count=1, MPI_BYTE, 1, 1, comm=0x84000003, request=0x55d4df9eff74) failed
internal_Issend(60749): Invalid rank has value 1 but must be nonnegative and less than 1
Abort(674890502) on node 0 (rank 0 in comm 416): application called MPI_Abort(comm=0x84000003, 674890502) - process 0

Is there any way to catch the error, and I can ignore this case so that the program will not break due to this error?

Or is there another way to avoid this type of error?

Some efforts to try to catch invalid input data is being made at: