3b1b/manim · error · ValueError
At least 2 mobjects needed for Intersection.
Error message
At least 2 mobjects needed for Intersection.
What it means
ValueError raised in Intersection.__init__ (manimlib/mobject/boolean_ops.py:81). Intersection folds pairwise skia-pathops intersection over the operand list starting from vmobjects[0] and vmobjects[1], so at least two mobjects are structurally required; with fewer than two there is nothing to intersect.
Source
Thrown at manimlib/mobject/boolean_ops.py:81
_convert_skia_path_to_vmobject(outpen, self)
class Difference(VMobject):
def __init__(self, subject: VMobject, clip: VMobject, **kwargs):
super().__init__(**kwargs)
outpen = pathops.Path()
pathops.difference(
[_convert_vmobject_to_skia_path(subject)],
[_convert_vmobject_to_skia_path(clip)],
outpen.getPen(),
)
_convert_skia_path_to_vmobject(outpen, self)
class Intersection(VMobject):
def __init__(self, *vmobjects: VMobject, **kwargs):
if len(vmobjects) < 2:
raise ValueError("At least 2 mobjects needed for Intersection.")
super().__init__(**kwargs)
outpen = pathops.Path()
pathops.intersection(
[_convert_vmobject_to_skia_path(vmobjects[0])],
[_convert_vmobject_to_skia_path(vmobjects[1])],
outpen.getPen(),
)
new_outpen = outpen
for _i in range(2, len(vmobjects)):
new_outpen = pathops.Path()
pathops.intersection(
[outpen],
[_convert_vmobject_to_skia_path(vmobjects[_i])],
new_outpen.getPen(),
)
outpen = new_outpen
_convert_skia_path_to_vmobject(outpen, self)
View on GitHub (pinned to dee01804d4)
Solutions
- Pass at least two VMobjects: Intersection(mob_a, mob_b, mob_c)
- Pre-check the splatted collection length before calling
- For a single shape use the shape itself; for zero shapes decide on an Empty/VGroup fallback
Example fix
# before overlap = Intersection(*regions) # raises if len(regions) < 2 # after assert len(regions) >= 2, "Intersection needs >= 2 mobjects" overlap = Intersection(*regions)
Defensive patterns
Strategy: validation
Validate before calling
if len(regions) < 2:
raise ValueError(f"Intersection needs >= 2 mobjects, got {len(regions)}")
overlap = Intersection(*regions) Type guard
def is_intersection_ready(mobs: list) -> bool:
return len(mobs) >= 2 Prevention
- Validate operand-list length before Intersection(*list)
- Watch for filters/slices that shrink a VGroup list below two elements
When it happens
Trigger: Intersection(one_mob), Intersection(), or Intersection(*groups) where the splat yields fewer than two mobjects (e.g. an empty VGroup spread).
Common situations: Calling Intersection(*vg) where vg was filtered or sliced to <2 elements; animations where one operand is conditionally removed; copy-paste from Union example with a single argument.
Related errors
- At least 2 mobjects needed for Union.
- At least 2 mobjects needed for Exclusion.
- Unsupported: {path_verb}
- Invalid input sample type
- Mobject cannot contain self
AI-assisted analysis of 3b1b/manim@dee01804d4 (2026-08-14).
Data as JSON: /api/errors/c5d031ee860e1889.
Report an issue: GitHub.