Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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.
repro.py
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
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.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).
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.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

Discussion

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

“The validation in pydantic differs from the dictionary validation definition”
@RajatRajdeep · 2024-10-21 · source
“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”
@RajatRajdeep · 2024-10-21 · source
“Hi @RajatRajdeep, Thanks a lot for your answer”
@sagerk · 2024-10-21 · source
“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.”
@Viicos · 2025-01-03 · source

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
signature.txt
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.txt
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

repro.py
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

When NOT to use: This fix does not apply if the behavior of ignoring extra attributes is desired.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix does not apply if the behavior of ignoring extra attributes is desired.

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

Related Issues

No related fixes found.

Sources

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