You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AssertionError: Must not defer during final iteration on large codebase #15723
Running mypy . on a large codebase that has not been type-checked crashed with AssertionError: Must not defer during final iteration.
mypy outputs 481 lines of messages (mostly errors and notes) before crashing. pyright on the same codebase results in 9756 errors.
Traceback
Traceback (most recent call last):
File "mypy/semanal.py", line 6451, in accept
File "mypy/nodes.py", line 786, in accept
File "mypy/semanal.py", line 833, in visit_func_def
File "mypy/semanal.py", line 868, in analyze_func_def
File "mypy/semanal.py", line 6123, in defer
AssertionError: Must not defer during final iteration
To Reproduce
It can be reproduced on our codebase, but no attempt to make small example was successful.
Unfortunately only info we can share publicly is above traceback.
Running mypy only on the file that the INTERNAL ERROR was raised did not result in crash.
Note: rm -rf .mypy_cache/ did not have any effect.
Your Environment
Mypy version used: 1.4.1
Mypy command-line flags:
Mypy configuration options from mypy.ini (and other config files):
Activity
A5rocks commentedon Jul 21, 2023
Does this reproduce on master? (I doubt anything's changed, but might be nicer!)
wyattscarpenter commentedon Sep 21, 2025
Also, were you possibly using the pydantic or django plugins, as mentioned in #15927 and its discussion?
ippeiukai commentedon Sep 22, 2025
I'm quite sure that I was working on a Django project, so django plugin was probably used. Not sure of pydantic.
wyattscarpenter commentedon Sep 22, 2025
Thanks!