{"record":{"id":"4f5e7ad4cbb45727","repo":"Comfy-Org/ComfyUI","slug":"bboxes-input-must-be-bounding-boxes-elements-or","errorCode":null,"errorMessage":"bboxes input must be bounding boxes, elements, or a JSON string, got {type(data).__name__}","messagePattern":"bboxes input must be bounding boxes, elements, or a JSON string, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_bounding_boxes.py","lineNumber":254,"sourceCode":"        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(\n            \"bboxes items must be bounding boxes (x, y, width, height) or elements (with a 'bbox')\"\n        )\n    raise ValueError(\n        f\"bboxes list must contain bounding boxes or elements, got {type(first).__name__}\"","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_bounding_boxes.py#L236-L272","documentation":"boxes_from_input only accepts str, dict, or list. Any other top-level type — int, float, tuple (Python-side call, not JSON), None-like objects, or a numpy array — reaches the final isinstance check and raises with the actual type name.","triggerScenarios":"Programmatically calling the API with a tuple of boxes (isinstance(data, list) is False for tuples); passing a numpy array of coordinates; passing a plain integer/float or an unwrapped tensor.","commonSituations":"Python callers reusing tuple literals out of habit; converting loaded data via numpy without .tolist(); API boundaries that deserialize JSON to non-list sequences.","solutions":["Convert to a list before calling: list(data) or data.tolist() for numpy arrays","Ensure JSON input arrives as a string (it will be parsed) rather than another primitive","Match the documented input contract: list, dict, or JSON string only"],"exampleFix":"// before\nboxes_from_input(((0, 0, 100, 100),), w, h)  # tuple -> raises\n\n// after\nboxes_from_input([(0, 0, 100, 100)], w, h)  # or list(((0,0,100,100),))","handlingStrategy":"type-guard","validationCode":"if isinstance(data, tuple):\n    data = list(data)\nelif hasattr(data, 'tolist'):\n    data = data.tolist()\nassert isinstance(data, (str, dict, list))","typeGuard":"def is_boxes_input(v) -> bool:\n    return isinstance(v, (str, dict, list))","tryCatchPattern":null,"preventionTips":["Convert tuples and numpy arrays to list before calling","Serialize with json.dumps when passing across process/API boundaries","Match the documented str/dict/list input contract"],"tags":["type-validation","bounding-box","python-types"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}