3b1b/manim · error · Exception

Cannot call Mobject.{} for a Mobject with no points

Error message

Cannot call Mobject.{} for a Mobject with no points

What it means

Formatted Exception from Mobject.throw_error_if_no_points (manimlib/mobject/mobject.py:2084): 'Cannot call Mobject.{caller} for a Mobject with no points', where {caller} is filled with the immediate caller's function name via sys._getframe(1). Geometry-dependent methods (get_start/get_end in mobject.py:1587-1595, and VMobject point accessors like get_start_anchors/get_end_anchors/get_first_handle/get_points in vectorized_mobject.py:666-726) call it when self.points is empty, because point math on a point-less mobject is meaningless.

Source

Thrown at manimlib/mobject/mobject.py:2084

        self.add_event_listner(EventType.KeyPressEvent, callback)

    def remove_key_press_listner(self, callback):
        self.remove_event_listner(EventType.KeyPressEvent, callback)

    def add_key_release_listner(self, callback):
        self.add_event_listner(EventType.KeyReleaseEvent, callback)

    def remove_key_release_listner(self, callback):
        self.remove_event_listner(EventType.KeyReleaseEvent, callback)

    # Errors

    def throw_error_if_no_points(self):
        if not self.has_points():
            message = "Cannot call Mobject.{} " +\
                      "for a Mobject with no points"
            caller_name = sys._getframe(1).f_code.co_name
            raise Exception(message.format(caller_name))


class Group(Mobject, Generic[SubmobjectType]):
    def __init__(self, *mobjects: SubmobjectType | Iterable[SubmobjectType], **kwargs):
        super().__init__(**kwargs)
        self._ingest_args(*mobjects)

    def _ingest_args(self, *args: Mobject | Iterable[Mobject]):
        if len(args) == 0:
            return
        if all(isinstance(mob, Mobject) for mob in args):
            self.add(*args)
        elif isinstance(args[0], Iterable):
            self.add(*args[0])
        else:
            raise Exception(f"Invalid argument to Group of type {type(args[0])}")

    def __add__(self, other: Mobject | Group) -> Self:

View on GitHub (pinned to dee01804d4)

Solutions

  1. Ensure the mobject has points before the call: use built-in shapes (Line, Circle) or implement init_points in custom subclasses
  2. Guard with mob.has_points() before calling point-dependent methods
  3. For containers, call the method on the child mobjects, not the empty container

Example fix

# before
mob = VMobject()
mob.get_start()  # raises: Cannot call Mobject.get_start ...

# after
mob = VMobject()
if mob.has_points():
    start = mob.get_start()
else:
    start = None
# or construct a real shape first: mob = Line(ORIGIN, RIGHT)
Defensive patterns

Strategy: validation

Validate before calling

if not mob.has_points():
    raise ValueError(f"{mob} has no points; initialize geometry first")
start = mob.get_start()

Type guard

def has_geometry(mob) -> bool:
    return mob.has_points()

Try / catch

try:
    p = mob.get_start()
except Exception as e:
    if "no points" in str(e):
        p = None
    else:
        raise

Prevention

When it happens

Trigger: Creating a bare Mobject/VMobject (which starts with no points) and calling get_start(), get_end(), get_start_anchors(), apply_function on empty points, or any of the guarded point accessors; calling point methods on a mobject whose points were cleared (e.g. after set_points([]) or before init_points).

Common situations: Instantiating VMobject subclasses without initializing points (custom subclass forgetting super().__init__ or init_points); calling geometric helpers on empty containers like VGroup (a Group has no own points) instead of its children; animation code calling get_start/get_end on freshly constructed mobjects before their geometry is generated.

Related errors


AI-assisted analysis of 3b1b/manim@dee01804d4 (2026-08-14). Data as JSON: /api/errors/47bddb714208da5c. Report an issue: GitHub.