Jump to solution
Verify

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

Jump to Verify Open PR/Commit
@@ -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
repro.py
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": [{}]}))
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.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).
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).
  • 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

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…”
@mpkocher · 2024-11-20 · source
“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”
@Viicos · 2024-11-20 · source
“I'll also note that you don't need to explicitly parametrize the TypeAdapter, type checker will infer the correct type just fine.”
@Viicos · 2024-11-20 · source

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

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

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/10530

First fixed release: 1.10.19

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

Related Issues

No related fixes found.

Sources

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