#5038·manim

LinearTransformationScene: a second apply_matrix raises ValueError: zip() argument 3 is longer than arguments 1-2

Author: ZacKienzle2Created Sep 28, 2026Updated Sep 28, 2026

Description of bug / unexpected behavior

In v0.21.0, a second call to LinearTransformationScene.apply_matrix raises ValueError: zip() argument 3 is longer than arguments 1-2. The LinearTransformationSceneExample from the documentation fails as soon as it applies its matrix twice. #3675 fixed successive calls in 2024, and they fail again in v0.21.0.

Open PR #4726 describes the cause: VectorScene keeps its own moving_mobjects, and Scene.play overwrites that attribute, so the transformation after any other animation, including a previous apply_matrix, moves the wrong mobjects. This issue gives that PR a report to close.

Expected behavior

The second apply_matrix shears the plane again, as the first one does.

How to reproduce the issue

Code for reproducing the problem
python
from manim import LinearTransformationScene


class LinearTransformationSceneExample(LinearTransformationScene):
    def __init__(self, **kwargs):
        LinearTransformationScene.__init__(
            self,
            show_coordinates=True,
            leave_ghost_vectors=True,
            **kwargs,
        )

    def construct(self):
        matrix = [[1, 1], [0, 1]]
        self.apply_matrix(matrix)
        self.apply_matrix(matrix)
        self.wait()

Additional media files

Images/GIFs

None: the scene stops with the error below before it writes a frame.

Logs

Terminal output
Manim Community v0.21.0

[09/29/26 00:10:59] DEBUG    Skipping animation 0                                                                                                                                                      cairo_renderer.py:76
                    DEBUG    List of the first few animation hashes of the scene: [None]                                                                                                              cairo_renderer.py:101

Animation 0: ApplyPointwiseFunction(NumberPlane of 4 submobjects), etc.:   0%|          | 0/1 [00:00<?, ?it/s]

                    DEBUG    Skipping animation 1                                                                                                                                                      cairo_renderer.py:76
                    DEBUG    List of the first few animation hashes of the scene: [None, None]                                                                                                        cairo_renderer.py:101
┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\cli\render\commands.py:125   │
│ in render                                                                                        │
│                                                                                                  │
│   122 │   │   │   try:                                                                           │
│   123 │   │   │   │   with tempconfig({}):                                                       │
│   124 │   │   │   │   │   scene = SceneClass()                                                   │
│ > 125 │   │   │   │   │   scene.render()                                                         │
│   126 │   │   │   except Exception:                                                              │
│   127 │   │   │   │   error_console.print_exception()                                            │
│   128 │   │   │   │   sys.exit(1)                                                                │
│                                                                                                  │
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\scene\scene.py:259 in render │
│                                                                                                  │
│    256 │   │   """                                                                               │
│    257 │   │   self.setup()                                                                      │
│    258 │   │   try:                                                                              │
│ >  259 │   │   │   self.construct()                                                              │
│    260 │   │   except EndSceneEarlyException:                                                    │
│    261 │   │   │   pass                                                                          │
│    262 │   │   except RerunSceneException:                                                       │
│                                                                                                  │
│ C:\Users\<user>\<project>\results\issues\successive_apply_matrix.py:16 in construct  │
│                                                                                                  │
│   13 │   def construct(self):                                                                    │
│   14 │   │   matrix = [[1, 1], [0, 1]]                                                           │
│   15 │   │   self.apply_matrix(matrix)                                                           │
│ > 16 │   │   self.apply_matrix(matrix)                                                           │
│   17 │   │   self.wait()                                                                         │
│   18                                                                                             │
│                                                                                                  │
│ C:\Users\<user>                                                                                     │
│ <project>\.venv\Lib\site-packages\manim\scene\vector_space_scene.py:1179 in       │
│ apply_matrix                                                                                     │
│                                                                                                  │
│   1176 │   │   **kwargs                                                                          │
│   1177 │   │   │   Any valid keyword argument of self.apply_transposed_matrix()                  │
│   1178 │   │   """                                                                               │
│ > 1179 │   │   self.apply_transposed_matrix(np.array(matrix).T, **kwargs)                        │
│   1180 │                                                                                         │
│   1181 │   def apply_inverse(self, matrix: np.ndarray | list | tuple, **kwargs: Any) -> None:    │
│   1182 │   │   """                                                                               │
│                                                                                                  │
│ C:\Users\<user>                                                                                     │
│ <project>\.venv\Lib\site-packages\manim\scene\vector_space_scene.py:1217 in       │
│ apply_transposed_matrix                                                                          │
│                                                                                                  │
│   1214 │   │   │   │   [angle_of_vector(func(RIGHT)), angle_of_vector(func(UP)) - np.pi / 2],    │
│   1215 │   │   │   )                                                                             │
│   1216 │   │   │   kwargs["path_arc"] = net_rotation                                             │
│ > 1217 │   │   self.apply_function(func, **kwargs)                                               │
│   1218 │                                                                                         │
│   1219 │   def apply_inverse_transpose(                                                          │
│   1220 │   │   self, t_matrix: np.ndarray | list | tuple, **kwargs: Any                          │
│                                                                                                  │
│ C:\Users\<user>                                                                                     │
│ <project>\.venv\Lib\site-packages\manim\scene\vector_space_scene.py:1294 in       │
│ apply_function                                                                                   │
│                                                                                                  │
│   1291 │   │   │   + [Animation(f_mob) for f_mob in self.foreground_mobjects]                    │
│   1292 │   │   │   + added_anims                                                                 │
│   1293 │   │   )                                                                                 │
│ > 1294 │   │   self.play(*anims, **kwargs)                                                       │
│   1295                                                                                           │
│                                                                                                  │
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\scene\scene.py:1207 in play  │
│                                                                                                  │
│   1204 │   │   │   return                                                                        │
│   1205 │   │                                                                                     │
│   1206 │   │   start_time = self.time                                                            │
│ > 1207 │   │   self.renderer.play(self, *args, **kwargs)                                         │
│   1208 │   │   run_time = self.time - start_time                                                 │
│   1209 │   │   if subcaption:                                                                    │
│   1210 │   │   │   if subcaption_duration is None:                                               │
│                                                                                                  │
│ C:\Users\<user>                                                                                     │
│ <project>\.venv\Lib\site-packages\manim\renderer\cairo_renderer.py:107 in play    │
│                                                                                                  │
│   104 │   │   )                                                                                  │
│   105 │   │                                                                                      │
│   106 │   │   self.file_writer.begin_animation(not self.skip_animations)                         │
│ > 107 │   │   scene.begin_animations()                                                           │
│   108 │   │                                                                                      │
│   109 │   │   # Save a static image, to avoid rendering non moving objects.                      │
│   110 │   │   self.save_static_frame_data(scene, scene.static_mobjects)                          │
│                                                                                                  │
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\scene\scene.py:1345 in       │
│ begin_animations                                                                                 │
│                                                                                                  │
│   1342 │   │   assert self.animations is not None                                                │
│   1343 │   │   for animation in self.animations:                                                 │
│   1344 │   │   │   animation._setup_scene(self)                                                  │
│ > 1345 │   │   │   animation.begin()                                                             │
│   1346 │   │                                                                                     │
│   1347 │   │   if config.renderer == RendererType.CAIRO:                                         │
│   1348 │   │   │   # Paint all non-moving objects onto the screen, so they don't                 │
│                                                                                                  │
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\animation\transform.py:212   │
│ in begin                                                                                         │
│                                                                                                  │
│   209 │   │   │   self.mobject.align_data_and_family(self.target_copy)                           │
│   210 │   │   else:                                                                              │
│   211 │   │   │   self.mobject.align_data(self.target_copy)                                      │
│ > 212 │   │   super().begin()                                                                    │
│   213 │                                                                                          │
│   214 │   def create_target(self) -> Mobject | OpenGLMobject:                                    │
│   215 │   │   # Has no meaningful effect here, but may be useful                                 │
│                                                                                                  │
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\animation\animation.py:214   │
│ in begin                                                                                         │
│                                                                                                  │
│   211 │   │   │   # the internal updaters of self.starting_mobject,                              │
│   212 │   │   │   # or any others among self.get_all_mobjects()                                  │
│   213 │   │   │   self.mobject.suspend_updating()                                                │
│ > 214 │   │   self.interpolate(0)                                                                │
│   215 │                                                                                          │
│   216 │   def finish(self) -> None:                                                              │
│   217 │   │   # TODO: begin and finish should require a scene as parameter.                      │
│                                                                                                  │
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\animation\animation.py:337   │
│ in interpolate                                                                                   │
│                                                                                                  │
│   334 │   │   │   The relative time to set the animation to, 0 meaning the start, 1 meaning      │
│   335 │   │   │   the end.                                                                       │
│   336 │   │   """                                                                                │
│ > 337 │   │   self.interpolate_mobject(alpha)                                                    │
│   338 │                                                                                          │
│   339 │   def interpolate_mobject(self, alpha: float) -> None:                                   │
│   340 │   │   """Interpolates the mobject of the :class:`Animation` based on alpha value.        │
│                                                                                                  │
│ C:\Users\<user>\<project>\.venv\Lib\site-packages\manim\animation\animation.py:349   │
│ in interpolate_mobject                                                                           │
│                                                                                                  │
│   346 │   │   │   is completed. For example, alpha-values of 0, 0.5, and 1 correspond            │
│   347 │   │   │   to the animation being completed 0%, 50%, and 100%, respectively.              │
│   348 │   │   """                                                                                │
│ > 349 │   │   families = list(self.get_all_families_zipped())                                    │
│   350 │   │   for i, mobs in enumerate(families):                                                │
│   351 │   │   │   sub_alpha = self.get_sub_alpha(alpha, i, len(families))                        │
│   352 │   │   │   self.interpolate_submobject(*mobs, sub_alpha)                                  │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
ValueError: zip() argument 3 is longer than arguments 1-2

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 11 Pro 10.0.26200
  • RAM: 31.1 GB
  • Python version (python/py/python3 --version): 3.12.14
  • Installed modules (provide output from pip list):
Package                                 Version                         Editable project location
--------------------------------------- ------------------------------- -------------------------------------
aiohappyeyeballs                        2.7.1
aiohttp                                 3.14.3
aiosignal                               1.4.0
annotated-types                         0.8.0
anyio                                   4.14.2
argon2-cffi                             25.1.0
argon2-cffi-bindings                    25.1.0
argparse-dataclass                      2.0.0
arrow                                   1.4.0
asttokens                               3.0.2
async-lru                               2.3.0
attrs                                   26.1.0
autograd                                1.9.1
autograd-gamma                          0.5.0
av                                      18.1.0
babel                                   2.18.0
beautifulsoup4                          4.15.0
bibliography                            0.1.dev17+gaaabc3772
bibtexparser                            1.4.4
bleach                                  6.4.0
certifi                                 2026.7.22
cffi                                    2.1.1
charset-normalizer                      3.5.1
click                                   8.5.0
cloup                                   4.0.0
colorama                                0.4.6
comm                                    0.2.3
conda-inject                            1.3.2
configargparse                          1.7.7
connection-pool                         0.0.3
contourpy                               1.3.3
coverage                                7.16.1
cycler                                  0.12.1
datasets                                5.0.1
debugpy                                 1.8.21
decorator                               5.3.1
defusedxml                              0.7.1
deptry                                  0.25.1
dill                                    0.4.1
docutils                                0.22.4
dpath                                   2.2.0
duckdb                                  1.5.5
executing                               2.2.1
fastjsonschema                          2.22.2
feedparser                              6.0.14
feedparser-sgmllib                      2.1.0
filelock                                3.32.3
fonttools                               4.63.0
formulaic                               1.2.2
fqdn                                    1.5.1
frozenlist                              1.8.0
fsspec                                  2026.6.0
gitdb                                   4.0.12
gitpython                               3.1.62
glcontext                               3.0.0
graphviz                                0.21
greenlet                                3.5.6
h11                                     0.16.0
habanero                                2.3.0
hf-xet