roboflow/supervision · error · ValueError
All or none of the '{name}' fields must be None
Error message
All or none of the '{name}' fields must be None What it means
Error "All or none of the '{name}' fields must be None" thrown in roboflow/supervision.
Source
Thrown at src/supervision/detection/core.py:2484
compact_list.append(m)
else:
dense = np.asarray(m, dtype=bool)
if dense.shape[1:] != image_shape:
raise ValueError(
f"Dense mask shape {dense.shape[1:]} does not match "
f"CompactMask image_shape {image_shape}."
)
compact_list.append(
CompactMask.from_dense(dense, d.xyxy, image_shape)
)
return CompactMask.merge(compact_list)
def stack_or_none(name: str) -> npt.NDArray[np.generic] | None:
values = [getattr(d, name) for d in detections_list]
if all(v is None for v in values):
return None
if any(v is None for v in values):
raise ValueError(f"All or none of the '{name}' fields must be None")
return cast(npt.NDArray[np.generic], np.hstack(values))
mask = cast(npt.NDArray[np.bool_] | CompactMask | None, stack_mask_or_none())
confidence = cast(npt.NDArray[np.floating] | None, stack_or_none("confidence"))
class_id = cast(npt.NDArray[np.integer] | None, stack_or_none("class_id"))
tracker_id = cast(npt.NDArray[np.integer] | None, stack_or_none("tracker_id"))
data = merge_data([d.data for d in detections_list])
metadata_list = [detections.metadata for detections in detections_list]
metadata = merge_metadata(metadata_list)
return cls(
xyxy=xyxy,
mask=mask,
confidence=confidence,
class_id=class_id,
tracker_id=tracker_id,View on GitHub (pinned to 7f254d9784)
Solutions
- Make the named field consistently None or not None across all objects being merged; do not mix.
- Populate the field on every object (or set it to None on every object) before merging.
When it happens
Trigger: Thrown at src/supervision/detection/core.py:2484 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15).
Data as JSON: /api/errors/9a95c4566c530de1.
Report an issue: GitHub.