ManimCommunity / ManimCommunity/manim

"Exception: Not sure how you reached here" when `ParametricFunction` takes invalid values

Open
#4,838 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior
I ran a MoveAlongPath on a parametric function that also raised a RuntimeWarning:
invalid value encountered in scalar power x = -((2 + t**-3)/(t**3 - 1))**(1/3).
I then also got an exception that said "Not sure how you reached here, please file a bug report at [github link]".

## Expected behavior
I'm pretty new to manim. I think I just expected it to work lol.

## How to reproduce the issue
Code for reproducing the problem

```py
from manim import *

def f(u, v):
if v == 0:
return int(bool(u)) # cheating a bit to let line cross through 0 but nowhere else.
return u/v + v - u + 2

# sub y = tx into f.
def fp(t):
x = -((2 + t**-3)/(t**3 - 1))**(1/3)
return x, t*x, 0

config.background_color = WHITE

class ImplicitGraph(Scene):
def construct(self):
x_range, y_range = (-5, 5), (-5, 5)
x_length, y_length = 2, 2

px, py = -1.8, 0.9
dot = Dot(
point = [px, py, 0],
radius=0.25,
color = BLUE,
)
parametric_func = ParametricFunction(
fp,
t_range = (-2, -0.5),
)

imp_params = {
"x_range": x_range,
"y_range": y_range,
"stroke_width": 2,
}

base_func = ImplicitFunction(
lambda x, y: f(x**3, y**3),
color = RED,
**imp_params,
)
tangent_func = ImplicitFunction(
lambda x, y: f(x*px**2, y*py**2),
color = BLUE,
**imp_params,
)

plane = NumberPlane(
x_range = x_range,
y_range = y_range,
axis_config = {
"stroke_color": BLACK,
"stroke_width": 2,
},
background_line_style = {
"stroke_color": BLACK,
"stroke_width": 1,
},
faded_line_style = {
"stroke_color": BLACK,
"stroke_width": 0.5,
},
faded_line_ratio = 1, # 5 for skinny lines
sheen_factor = 0.7,
).set_sheen_direction(UR)

g1 = Group(plane, base_func, tangent_func, dot)
g1.scale(0.2)

self.add(g1)
self.play(MoveAlongPath(dot, parametric_func))
```

## Additional media files

Images/GIFs

## Logs
Terminal output

[06/28/26 14:21:37] DEBUG Hashing ... hashing.py:360
[06/28/26 14:21:38] DEBUG Hashing done in 0.037776 s. hashing.py:372
DEBUG Hash generated : 3438438646_2346626982_1063212814 hashing.py:375
DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:103
['3438438646_2346626982_1063212814']
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\Fenwick\programming\videos\.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\Fenwick\programming\videos\.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\Fenwick\programming\videos\first-video\main.py:71 in construct │
│ │
│ 68 │ │ g1.scale(0.2) │
│ 69 │ │ │
│ 70 │ │ self.add(g1) │
│ ❱ 71 │ │ self.play(MoveAlongPath(dot, parametric_func)) │
│ 72 │
│ 73 │
│ │
│ C:\Users\Fenwick\programming\videos\.venv\Lib\site-packages\manim\scene\scene.py:1194 in play │
│ │
│ 1191 │ │ │ return │
│ 1192 │ │ │
│ 1193 │ │ start_time = self.time │
│ ❱ 1194 │ │ self.renderer.play(self, *args, **kwargs) │
│ 1195 │ │ run_time = self.time - start_time │
│ 1196 │ │ if subcaption: │
│ 1197 │ │ │ if subcaption_duration is None: │
│ │
│ C:\Users\Fenwick\programming\videos\.venv\Lib\site-packages\manim\renderer\cairo_renderer.py:109 │
│ in play │
│ │
│ 106 │ │ ) │
│ 107 │ │ │
│ 108 │ │ self.file_writer.begin_animation(not self.skip_animations) │
│ ❱ 109 │ │ scene.begin_animations() │
│ 110 │ │ │
│ 111 │ │ # Save a static image, to avoid rendering non moving objects. │
│ 112 │ │ self.save_static_frame_data(scene, scene.static_mobjects) │
│ │
│ C:\Users\Fenwick\programming\videos\.venv\Lib\site-packages\manim\scene\scene.py:1332 in │
│ begin_animations │
│ │
│ 1329 │ │ assert self.animations is not None │
│ 1330 │ │ for animation in self.animations: │
│ 1331 │ │ │ animation._setup_scene(self) │
│ ❱ 1332 │ │ │ animation.begin() │
│ 1333 │ │ │
│ 1334 │ │ if config.renderer == RendererType.CAIRO: │
│ 1335 │ │ │ # Paint all non-moving objects onto the screen, so they don't │
│ │
│ C:\Users\Fenwick\programming\videos\.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\Fenwick\programming\videos\.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\Fenwick\programming\videos\.venv\Lib\site-packages\manim\animation\movement.py:201 in │
│ interpolate_mobject │
│ │
│ 198 │ │ ) │
│ 199 │ │
│ 200 │ def interpolate_mobject(self, alpha: float) -> None: │
│ ❱ 201 │ │ point = self.path.point_from_proportion(self.rate_func(alpha)) │
│ 202 │ │ self.mobject.move_to(point) │
│ 203 │
│ │
│ C:\Users\Fenwick\programming\videos\.venv\Lib\site-packages\manim\mobject\types\vectorized_mobje │
│ ct.py:1586 in point_from_proportion │
│ │
│ 1583 │ │ │ │ return curve(residue) │
│ 1584 │ │ │ │
│ 1585 │ │ │ current_length += length │
│ ❱ 1586 │ │ raise Exception( │
│ 1587 │ │ │ "Not sure how you reached here, please file a bug report at https://github.c │
│ 1588 │ │ ) │
│ 1589 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Exception: Not sure how you reached here, please file a bug report at
https://github.com/ManimCommunity/manim/issues/new/choose

## System specifications

System Details

- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 11 v25H2
- RAM: 8GB DDR4
- Python version (`python/py/python3 --version`): 3.13
- Installed modules (provide output from `pip list`):
```
Package Version
----------------------- -------------------
absl-py 0.13.0
astunparse 1.6.3
cachetools 4.2.2
certifi 2021.5.30
chardet 4.0.0
cloudpickle 1.6.0
cycler 0.10.0
flatbuffers 1.12
gast 0.4.0
google-auth 1.32.1
google-auth-oauthlib 0.4.4
google-pasta 0.2.0
grpcio 1.34.1
gym 0.18.3
h5py 3.1.0
idna 2.10
joblib 1.0.1
keras-nightly 2.5.0.dev2021032900
Keras-Preprocessing 1.1.2
kiwisolver 1.3.1
Markdown 3.3.4
matplotlib 3.4.2
numpy 1.19.5
oauthlib 3.1.1
opencv-python 4.5.3.56
opt-einsum 3.3.0
Pillow 8.2.0
pip 21.1.3
protobuf 3.17.3
pyasn1 0.4.8
pyasn1-modules 0.2.8
pygame 2.0.1
pyglet 1.5.15
pyparsing 2.4.7
python-dateutil 2.8.1
requests 2.25.1
requests-oauthlib 1.3.0
rsa 4.7.2
scikit-learn 0.24.2
scipy 1.7.0
setuptools 56.0.0
six 1.15.0
sklearn 0.0
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorflow 2.5.0
tensorflow-estimator 2.5.0
termcolor 1.1.0
tflearn 0.5.0
threadpoolctl 2.1.0
typing-extensions 3.7.4.3
urllib3 1.26.6
Werkzeug 2.0.1
wheel 0.36.2
wrapt 1.12.1
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied scene and follow the traceback to animation/movement.py:201, where MoveAlongPath fails while beginning the animation. Compare the failure with the RuntimeWarning from the ParametricFunction and determine the intended behavior for the reported invalid values. Done should include a regression check for this reproduction and no unexplained internal exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.