Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy crashes with KeyError: 'type_is' #17250

Open
bersbersbers opened this issue May 16, 2024 · 3 comments
Open

mypy crashes with KeyError: 'type_is' #17250

bersbersbers opened this issue May 16, 2024 · 3 comments
Labels

Comments

@bersbersbers
Copy link

bersbersbers commented May 16, 2024

Crash Report

mypy crashes.

Traceback

> mypy .
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "c:\Code\project\.venv\Scripts\mypy.exe\__main__.py", line 8, in <module>
  File "C:\Code\project\.venv\Lib\site-packages\mypy\__main__.py", line 15, in console_entry
    main()
  File "mypy\main.py", line 100, in main
  File "mypy\main.py", line 182, in run_build
  File "mypy\build.py", line 192, in build
  File "mypy\build.py", line 266, in _build
  File "mypy\build.py", line 2942, in dispatch
  File "mypy\build.py", line 3333, in process_graph
  File "mypy\build.py", line 3411, in process_fresh_modules
  File "mypy\build.py", line 2099, in load_tree
  File "mypy\nodes.py", line 399, in deserialize
  File "mypy\nodes.py", line 3945, in deserialize
  File "mypy\nodes.py", line 3886, in deserialize
  File "mypy\nodes.py", line 260, in deserialize
  File "mypy\nodes.py", line 3315, in deserialize
  File "mypy\nodes.py", line 3945, in deserialize
  File "mypy\nodes.py", line 3886, in deserialize
  File "mypy\nodes.py", line 260, in deserialize
  File "mypy\nodes.py", line 824, in deserialize
  File "mypy\types.py", line 224, in deserialize_type
    result.overwrite_doc = self.overwrite_doc
  File "mypy\types.py", line 2266, in deserialize
KeyError: 'type_is'

To Reproduce

I am sorry I do not have reproduction steps. This happened about 5 times across two days, and when it happened, it always fixed itself by running mypy 2 or 3 more times. (Maybe that invalidates the cache?)

Your Environment

  • Mypy version used: mypy 1.10.0 (compiled: yes)
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: 3.12.3
  • Operating system and version: Windows 11 23H2
[tool.mypy]
strict = true

# https://github.com/pypa/setuptools/issues/3236
exclude = "build"

# https://github.com/matplotlib/matplotlib/issues/26942
untyped_calls_exclude = "matplotlib.dates.DateFormatter"
@bersbersbers
Copy link
Author

Yes, this is impossible to reproduce consistently. When I hit the issue, I can run mypy repeatedly, and it reproduces the same error many times. But as soon as I run mypy --cache-dir=nul, the issue is gone.

@cbadke
Copy link

cbadke commented May 20, 2024

fwiw, ran into the same, reverting to 1.9.0 resolved it for me.

@fennerm
Copy link

fennerm commented May 31, 2024

Ran into the same issue and also resolved by reverting to 1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants