3b1b/manim · error · Exception
bezier cannot be calld on an empty list
Error message
bezier cannot be calld on an empty list
What it means
Raised by bezier() (utils/bezier.py:32) when called with an empty sequence of control points. A Bezier curve needs at least one control point to evaluate the Bernstein-polynomial sum, so len(points) == 0 is rejected (note the typo 'calld' in the message).
Source
Thrown at manimlib/utils/bezier.py:32
from manimlib.utils.space_ops import z_to_vector
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Callable, Sequence, TypeVar, Tuple
from manimlib.typing import VectN, FloatArray, VectNArray, Vect3Array
Scalable = TypeVar("Scalable", float, FloatArray)
CLOSED_THRESHOLD = 0.001
def bezier(
points: Sequence[float | FloatArray] | VectNArray
) -> Callable[[float], float | FloatArray]:
if len(points) == 0:
raise Exception("bezier cannot be calld on an empty list")
n = len(points) - 1
def result(t: float) -> float | FloatArray:
return sum(
((1 - t)**(n - k)) * (t**k) * choose(n, k) * point
for k, point in enumerate(points)
)
return result
def partial_bezier_points(
points: Sequence[Scalable],
a: float,
b: float
) -> list[Scalable]:
"""View on GitHub (pinned to dee01804d4)
Solutions
- Guard the call site: if not points: return a constant (e.g. lambda t: 0.0) instead of invoking bezier()
- Fix the slicing/index logic so the control-point list is never empty before calling bezier()
- If it comes from a mobject with no points, initialize/retain points on the mobject (e.g. avoid a==b in partial ranges)
Example fix
# before curve = bezier(points[start:end]) # start >= end -> empty -> raises # after curve = bezier(points[start:end]) if start < end else (lambda t: points[start])
Defensive patterns
Strategy: validation
Validate before calling
pts = points[start:end]
if len(pts) == 0:
curve = lambda t: 0.0 # degenerate: no control points
else:
curve = bezier(pts) Prevention
- Never call bezier() without checking len(points) > 0
- Guard slices: ensure start < end before slicing control-point lists
- Avoid empty point arrays on mobjects passed to partial-interpolation utilities
When it happens
Trigger: Directly calling bezier([]); indirectly, manim internals computing interpolants for a VMobject whose points list is empty (e.g. partial_bezier_points or get_..._interpolant on a degenerate mobject with no points).
Common situations: Feeding bezier() a slice that happens to be empty (points[i:j] with i >= j); operating on VMobjects created without points or after pointwise_become_partial with a==b producing empty slices.
Related errors
- Lines do not intersect
- Unsupported: {path_verb}
- At least 2 mobjects needed for Union.
- At least 2 mobjects needed for Intersection.
- At least 2 mobjects needed for Exclusion.
AI-assisted analysis of 3b1b/manim@dee01804d4 (2026-08-14).
Data as JSON: /api/errors/d124edec382c2866.
Report an issue: GitHub.