{"record":{"id":"d59d49892e172025","repo":"huggingface/transformers","slug":"invalid-coco-panoptic-annotations-annotations-mus","errorCode":null,"errorMessage":"Invalid COCO panoptic annotations. Annotations must a dict (single image) or list of dicts (batch of images) with the following keys: `image_id`, `file_name` and `segments_info`, with the latter being a list of annotations in the COCO format.","messagePattern":"Invalid COCO panoptic annotations\\. Annotations must a dict \\(single image\\) or list of dicts \\(batch of images\\) with the following keys: `image_id`, `file_name` and `segments_info`, with the latter being a list of annotations in the COCO format\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/image_utils.py","lineNumber":997,"sourceCode":"def validate_annotations(\n    annotation_format: AnnotationFormat,\n    supported_annotation_formats: tuple[AnnotationFormat, ...],\n    annotations: list[dict],\n) -> None:\n    if annotation_format not in supported_annotation_formats:\n        raise ValueError(f\"Unsupported annotation format: {format} must be one of {supported_annotation_formats}\")\n\n    if annotation_format is AnnotationFormat.COCO_DETECTION:\n        if not valid_coco_detection_annotations(annotations):\n            raise ValueError(\n                \"Invalid COCO detection annotations. Annotations must a dict (single image) or list of dicts \"\n                \"(batch of images) with the following keys: `image_id` and `annotations`, with the latter \"\n                \"being a list of annotations in the COCO format.\"\n            )\n\n    if annotation_format is AnnotationFormat.COCO_PANOPTIC:\n        if not valid_coco_panoptic_annotations(annotations):\n            raise ValueError(\n                \"Invalid COCO panoptic annotations. Annotations must a dict (single image) or list of dicts \"\n                \"(batch of images) with the following keys: `image_id`, `file_name` and `segments_info`, with \"\n                \"the latter being a list of annotations in the COCO format.\"\n            )\n\n\ndef validate_kwargs(valid_processor_keys: list[str], captured_kwargs: list[str]):\n    unused_keys = set(captured_kwargs).difference(set(valid_processor_keys))\n    if unused_keys:\n        unused_key_str = \", \".join(unused_keys)\n        # TODO raise a warning here instead of simply logging?\n        logger.warning(f\"Unused or unrecognized kwargs: {unused_key_str}.\")\n\n\n@dataclass()\nclass SizeDict:\n    \"\"\"\n    Hashable dictionary to store image size information.","sourceCodeStart":979,"sourceCodeEnd":1015,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/image_utils.py#L979-L1015","documentation":"Error \"Invalid COCO panoptic annotations. Annotations must a dict (single image) or list of dicts (batch of images) with the following keys: `image_id`, `file_name` and `segments_info`, with the latter being a list of annotations in the COCO format.\" thrown in huggingface/transformers.","triggerScenarios":"Raised in COCO panoptic annotation validation when annotations lack image_id/file_name/segments_info structure.","commonSituations":"Malformed panoptic annotations missing segments_info or file_name in the COCO panoptic format.","solutions":["Provide annotations as dict(s) with 'image_id', 'file_name', and 'segments_info' keys in COCO panoptic format."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}