Title: mypy 1.18.x crashes (INTERNAL ERROR) on a pydantic v1.x definition · Issue #20055 · python/mypy · GitHub
Open Graph Title: mypy 1.18.x crashes (INTERNAL ERROR) on a pydantic v1.x definition · Issue #20055 · python/mypy
X Title: mypy 1.18.x crashes (INTERNAL ERROR) on a pydantic v1.x definition · Issue #20055 · python/mypy
Description: Bug Report When using latest mypy (1.18.2, but also reproduced with 1.18.1 - does not happen with 1.7.x) I get the following error when running mypy on a project thats using pydantic 1.10.22: ╰─❯ mypy --show-traceback my_service ~/Develo...
Open Graph Description: Bug Report When using latest mypy (1.18.2, but also reproduced with 1.18.1 - does not happen with 1.7.x) I get the following error when running mypy on a project thats using pydantic 1.10.22: ╰─❯ m...
X Description: Bug Report When using latest mypy (1.18.2, but also reproduced with 1.18.1 - does not happen with 1.7.x) I get the following error when running mypy on a project thats using pydantic 1.10.22: ╰─❯ m...
Opengraph URL: https://github.com/python/mypy/issues/20055
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mypy 1.18.x crashes (INTERNAL ERROR) on a pydantic v1.x definition","articleBody":"**Bug Report**\n\nWhen using latest mypy (`1.18.2`, but also reproduced with `1.18.1` - does *not* happen with `1.7.x`) I get the following error when running mypy on a project thats using pydantic `1.10.22`:\n\n```\n╰─❯ mypy --show-traceback my_service\n~/Development/sphinx/.venv/lib/python3.13/site-packages/pydantic/env_settings.py:23: error: INTERNAL ERROR -- Please try using mypy master on GitHub:\nhttps://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build\nPlease report a bug at https://github.com/python/mypy/issues\nversion: 1.18.1\nTraceback (most recent call last):\n File \"mypy/semanal.py\", line 7350, in accept\n File \"mypy/nodes.py\", line 1440, in accept\n File \"mypy/semanal.py\", line 1775, in visit_class_def\n File \"mypy/semanal.py\", line 1991, in analyze_class\n File \"mypy/semanal.py\", line 2038, in analyze_class_body_common\n File \"mypy/semanal.py\", line 2123, in apply_class_plugin_hooks\n File \"pydantic/mypy.py\", line 156, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback\n File \"pydantic/mypy.py\", line 319, in pydantic.mypy.PydanticModelTransformer.transform\n File \"pydantic/mypy.py\", line 529, in pydantic.mypy.PydanticModelTransformer.add_construct_method\n File \"pydantic/mypy.py\", line 868, in pydantic.mypy.add_method\nTypeError: tuple object expected; got list\n~Development/my-service/.venv/lib/python3.13/site-packages/pydantic/env_settings.py:23: : note: use --pdb to drop into pdb\n```\n**To Reproduce**\n\n```python\nfrom pydantic import BaseModel\n\n# Thats it - trying to run `mypy test.py` on this script will lead to the crash\n```\n\n**Expected Behavior**\nExpected static type checking to not crash..\n\n**Actual Behavior**\n\nmypy crashes with above mentioned exception.\n\n**Your Environment**\n\n- pydantic `1.10.22`\n- Mypy version used: `1.18.2`\n- Mypy command-line flags: `mypy my_package_dir`\n- Mypy configuration options from `mypy.ini` (and other config files):\n```\n[tool.mypy]\n plugins = [\"pydantic.mypy\"]\n ignore_missing_imports = true\n warn_redundant_casts = true\n warn_unused_ignores = true\n # Display the codes needed for # type: ignore[code] annotations.\n show_error_codes = true\n check_untyped_defs = true\n no_implicit_optional = true\n warn_unreachable = true\n disable_error_code = \"annotation-unchecked,override\"\n```\n- Python version used: `3.13.3`\n","author":{"url":"https://github.com/adamhadani","@type":"Person","name":"adamhadani"},"datePublished":"2025-10-13T15:14:38Z","url":"https://github.com/python/mypy/issues/20055"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5e47473d-2b95-b244-9729-829930b6cd74 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDA4:44D65:B7F86D:F65252:6B004E57 |
| html-safe-nonce | ee95bdb2b05156d6048cec63010f90f47e8f8c17fbbe19a298a8816a7ebb8846 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREE0OjQ0RDY1OkI3Rjg2RDpGNjUyNTI6NkIwMDRFNTciLCJ2aXNpdG9yX2lkIjoiNDYyMjA5Mjk4MzY3ODgxNTgzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0cb71114f2796549fbec1eb9eb16615f9a1b75c89087754807bc0c5d9f6c5c02 |
| hovercard-subject-tag | issue:3510451894 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/20055/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fb7ab0ac5717f618a1e4ac55fae5ce680c63248fa0b024c4bf01f63283ccafc8/python/mypy/issues/20055 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fb7ab0ac5717f618a1e4ac55fae5ce680c63248fa0b024c4bf01f63283ccafc8/python/mypy/issues/20055 |
| og:image:alt | Bug Report When using latest mypy (1.18.2, but also reproduced with 1.18.1 - does not happen with 1.7.x) I get the following error when running mypy on a project thats using pydantic 1.10.22: ╰─❯ m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | adamhadani |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width