COCOConverter throws untraceable Error (TopologyException)

Dear Labelbox Team,

I’m currently facing a work-breaking problem using the CocoConverter while exporting Masks and Annotations. My Ontology consists of segmentations only (No Polygons).


  • COCOConverter.serialize_panoptic()
  • COCOConverter.serialize_instances()
    fail with different error messages.

Both throw several of the following warnings, while running the methods:
TopologyException: Input geom 0 is invalid: Ring Self-intersection at xxx yyy

Panoptic errors out in the method CocoPanopticDataset.from_common( args ) :

ValueError: not enough values to unpack (expected 4, got 0)

Instances errors out with:

TopologicalError: The operation ‘GEOSDifference_r’ could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.multipolygon.MultiPolygon object at 0x13b70a1d0>

A problem with shapely and the invalidity of a segmentation seems the best lead here, but I can’t figure out which ones are faulty.

I would greatly appreciate some support and hints.

For error tracing: the project ID is

Package Versions:
labelbox = “3.27.2”
shapely = “1.8.5”

Many thanks and best regards,
Johannes Strodel

Hey Johannes,

It is possible that in the exported annotations, there are some seg mask links that has empty information.

Please feel free to follow up here if you have any questions, if you’d like, you can email my a copy of your annotations in


Hey Karen,

thank you for your reply. The annotation JSON contains an empty property “relationships” for each annotated image, which is indeed always empty (). But this does seem like it’s intended.
The export does not contain any string “link” so I’d send you a copy to your email for further investigations.

Thanks and best regards,