{"record":{"id":"084dd9d3d110a20d","repo":"keras-team/keras","slug":"expected-bounding-boxes-agurment-to-be-a-dict-wi","errorCode":null,"errorMessage":"Expected `bounding_boxes` agurment to be a dict with keys 'boxes' and 'labels'. Received: bounding_boxes={bounding_boxes}","messagePattern":"Expected `bounding_boxes` agurment to be a dict with keys 'boxes' and 'labels'\\. Received: bounding_boxes=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/validation.py","lineNumber":124,"sourceCode":"            default_value=labels_default_value,\n            shape=_classes_shape(\n                is_batched, bounding_boxes[\"labels\"].shape, max_boxes\n            ),\n        )\n        return bounding_boxes\n\n    bounding_boxes[\"boxes\"] = backend.convert_to_tensor(boxes, dtype=\"float32\")\n    bounding_boxes[\"labels\"] = backend.convert_to_tensor(labels)\n    return bounding_boxes\n\n\ndef validate_bounding_boxes(bounding_boxes):\n    if (\n        not isinstance(bounding_boxes, dict)\n        or \"labels\" not in bounding_boxes\n        or \"boxes\" not in bounding_boxes\n    ):\n        raise ValueError(\n            \"Expected `bounding_boxes` agurment to be a \"\n            \"dict with keys 'boxes' and 'labels'. Received: \"\n            f\"bounding_boxes={bounding_boxes}\"\n        )\n    boxes = bounding_boxes[\"boxes\"]\n    labels = bounding_boxes[\"labels\"]\n    if isinstance(boxes, list):\n        if not isinstance(labels, list):\n            raise ValueError(\n                \"If `bounding_boxes['boxes']` is a list, then \"\n                \"`bounding_boxes['labels']` must also be a list.\"\n                f\"Received: bounding_boxes['labels']={labels}\"\n            )\n        if len(boxes) != len(labels):\n            raise ValueError(\n                \"If `bounding_boxes['boxes']` and \"\n                \"`bounding_boxes['labels']` are both lists, \"\n                \"they must have the same length. Received: \"","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/validation.py#L106-L142","documentation":"validate_bounding_boxes is the shared sanity check that the bounding_boxes argument is a dict containing both required keys: 'boxes' and 'labels'. If the argument is not a dict at all, or is missing either key, this ValueError is raised (note the typo 'agurment' in the message).","triggerScenarios":"Passing a plain array of boxes, a dict with only {'boxes': ...}, or {'box': ..., 'label': ...} (singular keys) to densify_bounding_boxes or validate_bounding_boxes.","commonSituations":"Feeding detector output (often a list or tuple) directly into preprocessing layers; key-name drift between serialization formats and the expected API.","solutions":["Wrap the data as a dict with both keys: bounding_boxes={'boxes': boxes, 'labels': labels}.","Ensure the labels key is present even if all labels are dummy values (e.g. -1 padding labels).","Check for singular/plural key typos ('box'/'label') in dicts built from JSON."],"exampleFix":"# before\nout = densify_bounding_boxes(boxes_array)\n# after\nout = densify_bounding_boxes({\"boxes\": boxes_array, \"labels\": labels_array})","handlingStrategy":"type-guard","validationCode":"assert isinstance(bounding_boxes, dict) and {\"boxes\", \"labels\"} <= bounding_boxes.keys(), \"bounding_boxes must be a dict with 'boxes' and 'labels'\"","typeGuard":"def is_valid_bounding_boxes_dict(bb):\n    return isinstance(bb, dict) and \"boxes\" in bb and \"labels\" in bb\n","tryCatchPattern":null,"preventionTips":["Build bounding_boxes dicts in one factory function; never pass raw detector outputs straight to preprocessing layers."],"tags":["keras","bounding-boxes","validation","missing-key"],"backgroundTag":"schema-validation-failed","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}