Comfy-Org/ComfyUI · error · ValueError
bboxes dict must be a bounding box (x, y, width, height) or
Error message
bboxes dict must be a bounding box (x, y, width, height) or an element (with a 'bbox')
What it means
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.
Source
Thrown at comfy_extras/nodes_bounding_boxes.py:250
def boxes_from_input(data, width: int, height: int) -> list:
if data is None:
return []
if isinstance(data, str):
text = data.strip()
if not text:
return []
try:
data = json.loads(text)
except (ValueError, TypeError) as exc:
raise ValueError(f"bboxes string input is not valid JSON: {exc}") from exc
if isinstance(data, dict):
if _looks_like_element(data):
return elements_to_boxes([data], width, height)
if _looks_like_bbox(data):
return normalize_incoming_boxes(data)
raise ValueError(
"bboxes dict must be a bounding box (x, y, width, height) or an element (with a 'bbox')"
)
if not isinstance(data, list):
raise ValueError(
"bboxes input must be bounding boxes, elements, or a JSON string, "
f"got {type(data).__name__}"
)
if not data:
return []
first = data[0]
if isinstance(first, list):
return normalize_incoming_boxes(data)
if isinstance(first, dict):
if _looks_like_element(first):
return elements_to_boxes(data, width, height)
if _looks_like_bbox(first):
return normalize_incoming_boxes(data)
raise ValueError(View on GitHub (pinned to 1c6d8d45b3)
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
Example fix
// before
{"x1": 0, "y1": 0, "x2": 100, "y2": 100}
// after
{"x": 0, "y": 0, "width": 100, "height": 100} Defensive patterns
Strategy: type-guard
Validate before calling
def is_bbox_dict(d: dict) -> bool:
return all(k in d for k in ('x', 'y', 'width', 'height'))
def is_element_dict(d: dict) -> bool:
return isinstance(d.get('bbox'), (list, tuple)) and len(d['bbox']) == 4 Type guard
def is_supported_box_dict(v) -> bool:
if not isinstance(v, dict):
return False
return all(k in v for k in ('x', 'y', 'width', 'height')) or (
isinstance(v.get('bbox'), (list, tuple)) and len(v['bbox']) == 4) Prevention
- 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
When it happens
Trigger: 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.
Common situations: Adapter code mapping another API's coordinate convention (COCO corners, CSS top/left, abbreviated keys) directly into the node without renaming keys.
Related errors
- bboxes items must be bounding boxes (x, y, width, height) or
- bboxes element is missing a valid 'bbox' [ymin, xmin, ymax,
- bboxes element 'bbox' must contain four numbers
- bboxes string input is not valid JSON: {exc}
- HASH_CHECK_FAILED
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/b857e657c1a3bd56.
Report an issue: GitHub.