Skip to content

Improve error message for point_from_proportion with invalid (NaN) points - #5019

Open
webzuweb wants to merge 2 commits into
ManimCommunity:mainfrom
webzuweb:fix/point-from-proportion-nan-error
Open

webzuweb wants to merge 2 commits into
ManimCommunity:mainfrom
webzuweb:fix/point-from-proportion-nan-error

Conversation

@webzuweb

Copy link
Copy Markdown

Summary

Fixes #4838.

VMobject.point_from_proportion raised a cryptic Exception("Not sure how you reached here, please file a bug report ...") when the mobject's arc length was non-finite. This happens when the curve contains NaN/infinite points (e.g. a ParametricFunction evaluating to an invalid value), which makes every curve length NaN, so the arc-length walk never reaches the target length and falls through to the cryptic error.

Change

Replace the cryptic exception with an informative ValueError that reports the proportion, the target arc length, and the likely cause (NaN/infinite points).

Test

Added test_point_from_proportion_invalid_points_error which builds a VMobject with a NaN corner and asserts the new informative error is raised.

  • Local run: pytest tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py -k point_from_proportion → 3 passed.

Notes

Disclosed: this change was authored with AI assistance (model deepseek/deepseek-v4-pro), reviewed by @webzuweb.

webzuweb and others added 2 commits September 16, 2026 14:31
Replace the cryptic 'Not sure how you reached here' exception with an
informative ValueError when the arc length is non-finite. This happens
when the curve contains NaN/infinite points (e.g. a ParametricFunction
evaluating to an invalid value), which makes the arc length undefined.

Closes ManimCommunity#4838
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant