Jump to solution
Verify

The Fix

pip install pydantic==1.10.16

Based on closed pydantic/pydantic issue #10129 · PR/commit linked

Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.

Jump to Verify Open PR/Commit
@@ -57,6 +57,7 @@ TypeOfAny, TypeType, + TypeVarId, TypeVarType, UnionType,
repro.py
❯ mypy xxx/ --show-traceback /home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build Please report a bug at https://github.com/python/mypy/issues version: 1.11.1 Traceback (most recent call last): File "mypy/semanal.py", line 7092, in accept File "mypy/nodes.py", line 1183, in accept File "mypy/semanal.py", line 1700, in visit_class_def File "mypy/semanal.py", line 1891, in analyze_class File "mypy/semanal.py", line 1925, in analyze_class_body_common File "mypy/semanal.py", line 2010, in apply_class_plugin_hooks File "pydantic/mypy.py", line 154, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback File "pydantic/mypy.py", line 317, in pydantic.mypy.PydanticModelTransformer.transform File "pydantic/mypy.py", line 497, in pydantic.mypy.PydanticModelTransformer.add_construct_method File "mypy/types.py", line 607, in __init__ TypeError: mypy.types.TypeVarId object expected; got int /home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: : note: use --pdb to drop into pdb
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install pydantic==1.10.16\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n

Why This Fix Works in Production

  • Trigger: ❯ mypy xxx/ --show-traceback
  • Mechanism: The mypy plugin for Pydantic fails due to a change in the TypeVarType signature
  • Why the fix works: Fixes the mypy v1 plugin for an upcoming mypy release, addressing an internal error caused by a change in the TypeVarType signature. (first fixed release: 1.10.16).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Shows up under Python 3.10 in real deployments (not just unit tests).
  • The mypy plugin for Pydantic fails due to a change in the TypeVarType signature
  • Surfaces as: ❯ mypy xxx/ --show-traceback

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“This was fixed in Pydantic 1.10.16 (see https://github.com/pydantic/pydantic/pull/9586).”
@Viicos · 2024-08-14 · confirmation · source

Failure Signature (Search String)

  • ❯ mypy xxx/ --show-traceback

Error Message

Stack trace
error.txt
Error Message ------------- ❯ mypy xxx/ --show-traceback /home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build Please report a bug at https://github.com/python/mypy/issues version: 1.11.1 Traceback (most recent call last): File "mypy/semanal.py", line 7092, in accept File "mypy/nodes.py", line 1183, in accept File "mypy/semanal.py", line 1700, in visit_class_def File "mypy/semanal.py", line 1891, in analyze_class File "mypy/semanal.py", line 1925, in analyze_class_body_common File "mypy/semanal.py", line 2010, in apply_class_plugin_hooks File "pydantic/mypy.py", line 154, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback File "pydantic/mypy.py", line 317, in pydantic.mypy.PydanticModelTransformer.transform File "pydantic/mypy.py", line 497, in pydantic.mypy.PydanticModelTransformer.add_construct_method File "mypy/types.py", line 607, in __init__ TypeError: mypy.types.TypeVarId object expected; got int /home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: : note: use --pdb to drop into pdb

Minimal Reproduction

repro.py
❯ mypy xxx/ --show-traceback /home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build Please report a bug at https://github.com/python/mypy/issues version: 1.11.1 Traceback (most recent call last): File "mypy/semanal.py", line 7092, in accept File "mypy/nodes.py", line 1183, in accept File "mypy/semanal.py", line 1700, in visit_class_def File "mypy/semanal.py", line 1891, in analyze_class File "mypy/semanal.py", line 1925, in analyze_class_body_common File "mypy/semanal.py", line 2010, in apply_class_plugin_hooks File "pydantic/mypy.py", line 154, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback File "pydantic/mypy.py", line 317, in pydantic.mypy.PydanticModelTransformer.transform File "pydantic/mypy.py", line 497, in pydantic.mypy.PydanticModelTransformer.add_construct_method File "mypy/types.py", line 607, in __init__ TypeError: mypy.types.TypeVarId object expected; got int /home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: : note: use --pdb to drop into pdb

Environment

  • Python: 3.10
  • Pydantic: 1.10.11

Why It Broke

The mypy plugin for Pydantic fails due to a change in the TypeVarType signature

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==1.10.16

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/pydantic/pydantic/pull/9586

First fixed release: 1.10.16

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
1.10.16 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.