3b1b/manim · error · ValueError

Animation arguments can only be passed by calling ``animate`

Error message

Animation arguments can only be passed by calling ``animate`` or ``set_anim_args`` and can only be passed once

What it means

ValueError from _AnimBuilder.set_anim_args (manimlib/mobject/mobject.py:2204). Animation keyword arguments (run_time, rate_func, time_span, lag_ratio, path_arc, path_func...) may be attached to an animate expression exactly once, via either the immediate mob.animate(...) call or a later .set_anim_args(...); the can_pass_args flag flips False after the first pass, and a second attempt raises this.

Source

Thrown at manimlib/mobject/mobject.py:2204

        ]
        return sorted(set(methods+mobject_methods))

    def set_anim_args(self, **kwargs):
        '''
        You can change the args of :class:`~manimlib.animation.transform.Transform`, such as

        - ``run_time``
        - ``time_span``
        - ``rate_func``
        - ``lag_ratio``
        - ``path_arc``
        - ``path_func``

        and so on.
        '''

        if not self.can_pass_args:
            raise ValueError(
                "Animation arguments can only be passed by calling ``animate`` " + \
                "or ``set_anim_args`` and can only be passed once",
            )

        self.anim_args = kwargs
        self.can_pass_args = False
        return self

    def build(self):
        from manimlib.animation.transform import _MethodAnimation

        if self.overridden_animation:
            return self.overridden_animation

        return _MethodAnimation(self.mobject, self.methods, **self.anim_args)


def override_animate(method):

View on GitHub (pinned to dee01804d4)

Solutions

  1. Pass animation args exactly once: either mob.animate(run_time=2).shift(RIGHT) or mob.animate.shift(RIGHT).set_anim_args(run_time=2), not both
  2. Remove the second set_anim_args call from the chain
  3. Move timing arguments to self.play(..., run_time=2) instead of the builder if the builder already carries args

Example fix

# before
self.play(mob.animate(run_time=2).shift(RIGHT).set_anim_args(rate_func=smooth))  # ok
self.play(mob.animate(run_time=2).shift(RIGHT).set_anim_args(run_time=3))  # raises

# after
self.play(mob.animate(run_time=3).shift(RIGHT).set_anim_args(rate_func=smooth))
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: mob.animate(run_time=2).shift(RIGHT).set_anim_args(run_time=3); calling .set_anim_args(...) twice in one chain; passing run_time both to animate(...) and again via set_anim_args in the same expression.

Common situations: Refactoring code that used to pass run_time at play() level into the animate builder, leaving a duplicate; copy-pasting chains that already contain set_anim_args and appending another; helper functions that add anim args to an externally-built builder.

Related errors


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