3b1b/manim · error · TypeError
Object {anim} cannot be converted to an animation
Error message
Object {anim} cannot be converted to an animation What it means
prepare_animation normalizes arguments to scene.play(): it converts _AnimationBuilder objects (produced by mob.animate...) into real Animation instances and passes Animation instances through. Any other object raises TypeError with the object's repr, because the renderer has no way to animate it.
Source
Thrown at manimlib/animation/animation.py:244
def get_rate_func(self) -> Callable[[float], float]:
return self.rate_func
def set_name(self, name: str):
self.name = name
return self
def is_remover(self) -> bool:
return self.remover
def prepare_animation(anim: Animation | _AnimationBuilder):
if isinstance(anim, _AnimationBuilder):
return anim.build()
if isinstance(anim, Animation):
return anim
raise TypeError(f"Object {anim} cannot be converted to an animation")
View on GitHub (pinned to dee01804d4)
Solutions
- Wrap the mobject in an animation: self.play(FadeOut(circle)), self.play(Write(text))
- Use the .animate builder: self.play(circle.animate.shift(RIGHT))
- If you want to add without animating, call self.add(mobject) instead of self.play(mobject)
Example fix
# before self.play(circle) # after self.play(Create(circle))
Defensive patterns
Strategy: type-guard
Validate before calling
from manimlib.animation.animation import Animation, prepare_animation anims = [prepare_animation(a) for a in my_list] # raises TypeError early with full list context self.play(*anims)
Type guard
from manimlib.animation.animation import Animation
from manimlib.animation.animation import _AnimationBuilder
def is_animatable(x) -> bool:
return isinstance(x, (Animation, _AnimationBuilder)) Prevention
- Every element passed to play() must be an Animation, an _AnimationBuilder (from .animate), or an mobject.animate chain
- To add without animating use self.add(mob), never self.play(mob)
When it happens
Trigger: self.play(circle) (a bare Mobject); self.play('fade') (a string); self.play(some_decorator_result); passing an _AnimationBuilder that was already built earlier (an Animation is fine, but e.g. a tuple of builders unpacked wrongly is not).
Common situations: Forgetting the animation class: play(FadeOut(mob)) not play(mob); expecting play() to implicitly add mobjects like play(ShowCreation) misremembered; passing the result of a helper that returns None.
Related errors
- Animation only works for Mobjects.
- Trying to restore without having saved
- Method chaining is currently not supported for overridden an
- Animation arguments can only be passed by calling ``animate`
- Invalid selector: '{sel}'
AI-assisted analysis of 3b1b/manim@dee01804d4 (2026-08-14).
Data as JSON: /api/errors/00764dda13533c8a.
Report an issue: GitHub.