Jump to solution
Verify

The Fix

pip install pydantic==1.10.17

Based on closed pydantic/pydantic issue #9187 · 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
@@ -1783,11 +1783,11 @@ the type annotation for `__pydantic_extra__`: from typing import Dict -from pydantic import BaseModel, ConfigDict, ValidationError +from pydantic import BaseModel, ConfigDict, Field, ValidationError
repro.py
from pydantic import BaseModel, ConfigDict class Model(BaseModel): __pydantic_extra__: dict[str, int] a: int model_config = ConfigDict(extra="allow") m = Model(a=1) # Argument missing for parameter "__pydantic_extra__" Pylance (reportCallIssue)
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.17\nWhen NOT to use: This fix should not be used if the model requires __pydantic_extra__ to be a mandatory argument.\n\nOption C — Workaround\nis to define your model as:\nWhen NOT to use: This fix should not be used if the model requires __pydantic_extra__ to be a mandatory argument.\n\n

Why This Fix Works in Production

  • Trigger: Pyright/Pylance typing error when overriding `__pydantic_extra__` type
  • Mechanism: The type annotation for __pydantic_extra__ was not properly handled in the model's __init__ method
  • Why the fix works: Allows a field specifier on __pydantic_extra__, addressing the typing error when overriding this type. (first fixed release: 1.10.17).
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

  • The type annotation for __pydantic_extra__ was not properly handled in the model's __init__ method
  • Production symptom (often without a traceback): Pyright/Pylance typing error when overriding `__pydantic_extra__` type

Proof / Evidence

Discussion

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

“When https://github.com/pydantic/pydantic/pull/9659 gets merged, I think the solution to this will be to do: (or similar, with whatever type hint you want on the pydantic…”
@dmontagu · 2024-06-14 · confirmation · source
“Looks good as a workaround, so the docs can probably be updated with the added PrivateAttr. #9293 already applied the change on the BaseModel.__pydantic_extra__ annotation…”
@Viicos · 2024-05-21 · source
“@zEdS15B3GCwq, Thanks for reporting this! Yep, looks like a bug. Great first issue, for anyone interested!”
@sydney-runkle · 2024-04-09 · source
“@Viicos, What do you think about this approach here (we might need some docs changes): Thinking about this approach on the heels of https://github.com/pydantic/pydantic/pull/9293”
@sydney-runkle · 2024-05-21 · source

Failure Signature (Search String)

  • Pyright/Pylance typing error when overriding `__pydantic_extra__` type
  • Similar to #9147 and #7094, but those seem to be focused on `TypeAdapter` and I'm unsure how closely those are related. Sorry if this is a duplicate.
Copy-friendly signature
signature.txt
Failure Signature ----------------- Pyright/Pylance typing error when overriding `__pydantic_extra__` type Similar to #9147 and #7094, but those seem to be focused on `TypeAdapter` and I'm unsure how closely those are related. Sorry if this is a duplicate.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Pyright/Pylance typing error when overriding `__pydantic_extra__` type Similar to #9147 and #7094, but those seem to be focused on `TypeAdapter` and I'm unsure how closely those are related. Sorry if this is a duplicate.

Minimal Reproduction

repro.py
from pydantic import BaseModel, ConfigDict class Model(BaseModel): __pydantic_extra__: dict[str, int] a: int model_config = ConfigDict(extra="allow") m = Model(a=1) # Argument missing for parameter "__pydantic_extra__" Pylance (reportCallIssue)

Environment

  • Pydantic: 2

What Broke

Type checkers report missing argument errors when instantiating models with __pydantic_extra__.

Why It Broke

The type annotation for __pydantic_extra__ was not properly handled in the model's __init__ method

Fix Options (Details)

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

pip install pydantic==1.10.17

When NOT to use: This fix should not be used if the model requires __pydantic_extra__ to be a mandatory argument.

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

Option C — Workaround Temporary workaround

is to define your model as:

When NOT to use: This fix should not be used if the model requires __pydantic_extra__ to be a mandatory argument.

Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.

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

First fixed release: 1.10.17

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

  • This fix should not be used if the model requires __pydantic_extra__ to be a mandatory argument.

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.17 Fixed

Related Issues

No related fixes found.

Sources

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