{"record":{"id":"0fe0ec12fda46972","repo":"roboflow/supervision","slug":"labelme-shape-of-type-shape-type-is-missing-the","errorCode":null,"errorMessage":"LabelMe shape of type {shape_type} is missing the required {missing} field.","messagePattern":"LabelMe shape of type (.+?) is missing the required (.+?) field\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/dataset/formats/labelme.py","lineNumber":106,"sourceCode":"\n    Warns:\n        UserWarning: When unsupported shape types are encountered and skipped.\n    \"\"\"\n    xyxy_list: list[npt.NDArray[np.float32]] = []\n    class_ids: list[int] = []\n    polygons: list[npt.NDArray[np.float32]] = []\n    skipped_types: set[str] = set()\n\n    for shape in shapes:\n        shape_type = shape.get(\"shape_type\")\n        if shape_type not in SUPPORTED_SHAPE_TYPES:\n            skipped_types.add(str(shape_type))\n            continue\n        label = shape.get(\"label\")\n        points_raw = shape.get(\"points\")\n        if label is None or points_raw is None:\n            missing = \"label\" if label is None else \"points\"\n            raise ValueError(\n                f\"LabelMe shape of type {shape_type!r} is missing the \"\n                f\"required {missing!r} field.\"\n            )\n        points = np.array(points_raw, dtype=np.float32)\n        if points.ndim != 2 or points.shape[1] != 2:\n            raise ValueError(\n                f\"LabelMe shape of type {shape_type!r} (label={label!r}) has \"\n                f\"malformed points: expected an (N, 2) array, got shape \"\n                f\"{points.shape}.\"\n            )\n        if shape_type == \"rectangle\":\n            if len(points) < 2:\n                raise ValueError(\n                    f\"LabelMe rectangle shape (label={label!r}) has \"\n                    f\"{len(points)} point(s); expected at least 2.\"\n                )\n            xyxy = _rectangle_to_xyxy(points)\n            polygon = _xyxy_to_polygon(xyxy)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/dataset/formats/labelme.py#L88-L124","documentation":"Raised while parsing LabelMe JSON when a shape of a supported type (polygon/rectangle) is missing its 'label' or 'points' field (or points is null). Every LabelMe shape must carry both a class label and a point list; the message names which field is absent so you can fix the JSON directly.","triggerScenarios":"DetectionDataset.from_labelme on a directory where some shape dict in a .json file lacks the 'label' or 'points' key — e.g. hand-written JSON, partial exports, or converter bugs.","commonSituations":"Annotations generated by scripts (not the LabelMe app) that omit fields; JSON edited by hand; older/alternative tools writing a schema without points for certain shapes; truncated files.","solutions":["Open the failing .json and find the shape whose 'label' or 'points' key is absent (the error names the field and shape_type).","Add the missing field: a non-empty string label, and points as [[x, y], ...].","If the shape is junk, delete it from the shapes array.","Fix the upstream converter so it always writes both fields, then re-export."],"exampleFix":"// before\n{\"shape_type\": \"polygon\", \"points\": [[1, 2], [3, 4]]}\n// after\n{\"shape_type\": \"polygon\", \"label\": \"cat\", \"points\": [[1, 2], [3, 4]]}","handlingStrategy":"validation","validationCode":"SUPPORTED = {'polygon', 'rectangle'}\n\ndef shapes_well_formed(shapes: list[dict]) -> bool:\n    \"\"\"Every supported LabelMe shape has label and points fields.\"\"\"\n    return all(s.get('shape_type') not in SUPPORTED\n               or (s.get('label') is not None and s.get('points') is not None)\n               for s in shapes)","typeGuard":null,"tryCatchPattern":"try:\n    dataset = sv.DetectionDataset.from_labelme(images_dir, ann_dir)\nexcept ValueError as e:\n    if 'missing the required' in str(e):\n        raise SystemExit(f'Corrupt LabelMe JSON — add the named field: {e}') from e\n    raise","preventionTips":["Use the official LabelMe app or battle-tested exporters to write JSON.","Lint annotation JSON in dataset CI before training runs.","Never hand-strip fields from LabelMe files."],"tags":["labelme","dataset","json","annotation-format"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}