The Fix
pip install pydantic==1.10.20
Based on closed pydantic/pydantic issue #10644 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -45,7 +45,7 @@ except ValidationError as e:
```
-1. See the [Extra Attributes](models.md#extra-fields) section for more details.
+1. See the [Extra data](models.md#extra-data) section for more details.
from pydantic.dataclasses import dataclass
@dataclass
class Test():
a: int
b: int
test = Test(a=1, b=2, c=3, d=4) # does not fail
test.c # fails
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install pydantic==1.10.20\nWhen NOT to use: This fix does not apply if the behavior of ignoring extra attributes is desired.\n\n
Why This Fix Works in Production
- Trigger: Unexpected Behavior with Extra Arguments in Pydantic Dataclass
- Mechanism: Pydantic dataclass accepts extra keyword arguments without raising errors, unlike standard Python dataclasses
- Why the fix works: The documentation was reorganized to clarify the behavior of extra data in Pydantic models, addressing confusion about how extra attributes are handled during initialization. (first fixed release: 1.10.20).
- 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.11 in real deployments (not just unit tests).
- Pydantic dataclass accepts extra keyword arguments without raising errors, unlike standard Python dataclasses
- Production symptom (often without a traceback): Unexpected Behavior with Extra Arguments in Pydantic Dataclass
Proof / Evidence
- GitHub issue: #10644
- Fix PR: https://github.com/pydantic/pydantic/pull/11213
- First fixed release: 1.10.20
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.69
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“The validation in pydantic differs from the dictionary validation definition”
“For the issue in https://github.com/pydantic/pydantic/issues/10644#issuecomment-2424232760, I have raised separate issue: https://github.com/pydantic/pydantic/issues/10679”
“Hi @RajatRajdeep, Thanks a lot for your answer”
“https://github.com/pydantic/pydantic/pull/11213 updates the documentation to move the section about extra data being ignored by default at the beginning of the documentation to be more visible.”
Failure Signature (Search String)
- Unexpected Behavior with Extra Arguments in Pydantic Dataclass
- Pydantic dataclass silently accepts extra keyword arguments during initialization but doesn't store them as attributes, leading to potentially confusing behavior.
Copy-friendly signature
Failure Signature
-----------------
Unexpected Behavior with Extra Arguments in Pydantic Dataclass
Pydantic dataclass silently accepts extra keyword arguments during initialization but doesn't store them as attributes, leading to potentially confusing behavior.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Unexpected Behavior with Extra Arguments in Pydantic Dataclass
Pydantic dataclass silently accepts extra keyword arguments during initialization but doesn't store them as attributes, leading to potentially confusing behavior.
Minimal Reproduction
from pydantic.dataclasses import dataclass
@dataclass
class Test():
a: int
b: int
test = Test(a=1, b=2, c=3, d=4) # does not fail
test.c # fails
Environment
- Python: 3.11
- Pydantic: 2
What Broke
Users experience AttributeError when accessing extra attributes that are not stored.
Why It Broke
Pydantic dataclass accepts extra keyword arguments without raising errors, unlike standard Python dataclasses
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.20
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/11213
First fixed release: 1.10.20
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix does not apply if the behavior of ignoring extra attributes is desired.
Verify Fix
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
| Version | Status |
|---|---|
| 1.10.20 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.