The Fix
pip install pydantic==1.10.19
Based on closed pydantic/pydantic issue #10889 · 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%.
@@ -51,7 +51,7 @@ from datetime import datetime
from pydantic import BaseModel
-from pydantic.experimental.pipeline import validate_as, validate_as_deferred
+from pydantic.experimental.pipeline import validate_as
from __future__ import annotations
import dataclasses
from pydantic import Field, TypeAdapter
@dataclasses.dataclass(frozen=True, slots=True, kw_only=True)
class Text:
title: str = Field("", alias="Title")
language: str = Field("", alias="Language")
@dataclasses.dataclass(frozen=True, slots=True, kw_only=True)
class MediaInfo:
text: list[Text] = Field(default_factory=list)
T = TypeAdapter[MediaInfo](MediaInfo)
print(T.validate_python({"text": [{}]}))
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.19\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: I have a dataclasses named `Text` and pydantic think it's str and failed dict input
- Mechanism: Pydantic incorrectly interprets dataclass annotations when using future annotations
- Why the fix works: Refactor namespace logic for annotations evaluation to resolve issues with dataclass annotations in Pydantic. (first fixed release: 1.10.19).
- 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).
- Pydantic incorrectly interprets dataclass annotations when using future annotations
- Production symptom (often without a traceback): I have a dataclasses named `Text` and pydantic think it's str and failed dict input
Proof / Evidence
- GitHub issue: #10889
- Fix PR: https://github.com/pydantic/pydantic/pull/10530
- First fixed release: 1.10.19
- 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.56
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Changing T = TypeAdapterMediaInfo to T = TypeAdapter(MediaInfo) might fix your problem or provide a workaround. Using TypeAdapter[X] will generate peculiar behavior. Perhaps #9782 is…”
“A refactor landing in 2.10 cleaned up the annotations evaluation of dataclasses, meaning you won't see the issue in the new release coming this week”
“I'll also note that you don't need to explicitly parametrize the TypeAdapter, type checker will infer the correct type just fine.”
Failure Signature (Search String)
- I have a dataclasses named `Text` and pydantic think it's str and failed dict input
- Changing `T = TypeAdapter[MediaInfo](MediaInfo)` to `T = TypeAdapter(MediaInfo)` might fix your problem or provide a workaround.
Copy-friendly signature
Failure Signature
-----------------
I have a dataclasses named `Text` and pydantic think it's str and failed dict input
Changing `T = TypeAdapter[MediaInfo](MediaInfo)` to `T = TypeAdapter(MediaInfo)` might fix your problem or provide a workaround.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
I have a dataclasses named `Text` and pydantic think it's str and failed dict input
Changing `T = TypeAdapter[MediaInfo](MediaInfo)` to `T = TypeAdapter(MediaInfo)` might fix your problem or provide a workaround.
Minimal Reproduction
from __future__ import annotations
import dataclasses
from pydantic import Field, TypeAdapter
@dataclasses.dataclass(frozen=True, slots=True, kw_only=True)
class Text:
title: str = Field("", alias="Title")
language: str = Field("", alias="Language")
@dataclasses.dataclass(frozen=True, slots=True, kw_only=True)
class MediaInfo:
text: list[Text] = Field(default_factory=list)
T = TypeAdapter[MediaInfo](MediaInfo)
print(T.validate_python({"text": [{}]}))
Environment
- Python: 3.10
- Pydantic: 2
What Broke
Users experience validation failures when providing input for dataclass fields.
Why It Broke
Pydantic incorrectly interprets dataclass annotations when using future annotations
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.19
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/10530
First fixed release: 1.10.19
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
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.19 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.