{"record":{"id":"b857e657c1a3bd56","repo":"Comfy-Org/ComfyUI","slug":"bboxes-dict-must-be-a-bounding-box-x-y-width-h","errorCode":null,"errorMessage":"bboxes dict must be a bounding box (x, y, width, height) or an element (with a 'bbox')","messagePattern":"bboxes dict must be a bounding box \\(x, y, width, height\\) or an element \\(with a 'bbox'\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_bounding_boxes.py","lineNumber":250,"sourceCode":"\n\ndef boxes_from_input(data, width: int, height: int) -> list:\n    if data is None:\n        return []\n    if isinstance(data, str):\n        text = data.strip()\n        if not text:\n            return []\n        try:\n            data = json.loads(text)\n        except (ValueError, TypeError) as exc:\n            raise ValueError(f\"bboxes string input is not valid JSON: {exc}\") from exc\n    if isinstance(data, dict):\n        if _looks_like_element(data):\n            return elements_to_boxes([data], width, height)\n        if _looks_like_bbox(data):\n            return normalize_incoming_boxes(data)\n        raise ValueError(\n            \"bboxes dict must be a bounding box (x, y, width, height) or an element (with a 'bbox')\"\n        )\n    if not isinstance(data, list):\n        raise ValueError(\n            \"bboxes input must be bounding boxes, elements, or a JSON string, \"\n            f\"got {type(data).__name__}\"\n        )\n    if not data:\n        return []\n    first = data[0]\n    if isinstance(first, list):\n        return normalize_incoming_boxes(data)\n    if isinstance(first, dict):\n        if _looks_like_element(first):\n            return elements_to_boxes(data, width, height)\n        if _looks_like_bbox(first):\n            return normalize_incoming_boxes(data)\n        raise ValueError(","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_bounding_boxes.py#L232-L268","documentation":"When boxes_from_input receives a single dict (not a list), it tries two shapes: an 'element' (has a bbox) or a 'bbox box' (has x,y,width,height). A dict matching neither shape — e.g. {top,left,right,bottom} or {x1,y1,x2,y2} — raises this error.","triggerScenarios":"Passing {'x1':..,'y1':..,'x2':..,'y2':..}, {'top':..,'left':..,'bottom':..,'right':..}, or {'x':..,'y':..,'w':..,'h':..} (w/h abbreviations) instead of exact keys x/y/width/height.","commonSituations":"Adapter code mapping another API's coordinate convention (COCO corners, CSS top/left, abbreviated keys) directly into the node without renaming keys.","solutions":["Rename keys to x, y, width, height (box) or use an element with bbox [ymin, xmin, ymax, xmax]","Wrap a single dict in a list and use the exact schema the node documents","Write a small mapper from your source convention before calling the node"],"exampleFix":"// before\n{\"x1\": 0, \"y1\": 0, \"x2\": 100, \"y2\": 100}\n\n// after\n{\"x\": 0, \"y\": 0, \"width\": 100, \"height\": 100}","handlingStrategy":"type-guard","validationCode":"def is_bbox_dict(d: dict) -> bool:\n    return all(k in d for k in ('x', 'y', 'width', 'height'))\n\ndef is_element_dict(d: dict) -> bool:\n    return isinstance(d.get('bbox'), (list, tuple)) and len(d['bbox']) == 4","typeGuard":"def is_supported_box_dict(v) -> bool:\n    if not isinstance(v, dict):\n        return False\n    return all(k in v for k in ('x', 'y', 'width', 'height')) or (\n        isinstance(v.get('bbox'), (list, tuple)) and len(v['bbox']) == 4)","tryCatchPattern":null,"preventionTips":["Rename source keys to x/y/width/height at your adapter layer","Document and test the exact dict schemas your pipeline accepts","Prefer element+bbox form for corner-coordinate sources"],"tags":["json","bounding-box","schema-mismatch"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}