Jump to solution
Verify

The Fix

pip install pydantic==2.6.1

Based on closed pydantic/pydantic issue #8670 · 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
@@ -93,7 +93,7 @@ def dataclass( @dataclass_transform(field_specifiers=(dataclasses.field, Field)) -def dataclass( +def dataclass( # noqa: C901 _cls: type[_T] | None = None,
repro.py
from pydantic import dataclasses class A: a: int = dataclasses.Field() @dataclasses.dataclass() class B(A): ...
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==2.6.1\nWhen NOT to use: This fix should not be applied if the base class is not decorated with Pydantic's dataclass.\n\nOption B — Safe version pin\npip install pydantic==2.5\nWhen NOT to use: Do not use if you need features or security fixes in newer releases.\n\n

Why This Fix Works in Production

  • Trigger: class B(A):
  • Mechanism: Inheritance issue with Pydantic dataclasses caused annotations to be lost when using Field in inherited classes
  • Why the fix works: Fixes an inheritance issue with Pydantic dataclasses where annotations were lost when using Field in inherited classes. (first fixed release: 2.6.1).
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.8 in real deployments (not just unit tests).
  • Inheritance issue with Pydantic dataclasses caused annotations to be lost when using Field in inherited classes
  • Surfaces as: Traceback (most recent call last):

Proof / Evidence

Verified Execution

We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.

  • Status: PASS
  • Ran: 2026-02-11T16:52:29Z
  • Package: pydantic
  • Fixed: 2.6.1
  • Mode: fixed_only
  • Outcome: ok
Logs
affected (exit=None)
fixed (exit=0)

Discussion

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

“@mwalsh161, I've merged a PR with a fix for this issue (in the case of the decorated base class), and we'll include this in the…”
@sydney-runkle · 2024-02-01 · confirmation · source
“The issue has been introduced in https://github.com/pydantic/pydantic/commit/2e459bb563dbc296c2bcffbfd1a3caf21241b8e0”
@hramezani · 2024-01-29 · source
“Excellent point - that was a transcription error on my part (our actual use-case wraps both). That case will yield the same error (just reconfirmed…”
@mwalsh161 · 2024-01-30 · source
“@mwalsh161, Thanks for reporting this. We'll come up with a fix and hopefully get a patch release out tomorrow!”
@sydney-runkle · 2024-01-29 · source

Failure Signature (Search String)

  • class B(A):

Error Message

Stack trace
error.txt
Error Message ------------- Traceback (most recent call last): File "pydantic2.6.py", line 9, in <module> class B(A): File ".../pydantic/dataclasses.py", line 218, in create_dataclass cls = dataclasses.dataclass( # type: ignore[call-overload] File ".../dataclasses.py", line 1019, in dataclass return wrap(cls) File ".../dataclasses.py", line 1011, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen) File ".../dataclasses.py", line 885, in _process_class raise TypeError(f'{name!r} is a field but has no type annotation') TypeError: 'a' is a field but has no type annotation

Minimal Reproduction

repro.py
from pydantic import dataclasses class A: a: int = dataclasses.Field() @dataclasses.dataclass() class B(A): ...

Environment

  • Python: 3.8
  • Pydantic: 2

What Broke

Users experienced TypeErrors when attempting to instantiate subclasses with inherited fields.

Why It Broke

Inheritance issue with Pydantic dataclasses caused annotations to be lost when using Field in inherited classes

Fix Options (Details)

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

pip install pydantic==2.6.1

When NOT to use: This fix should not be applied if the base class is not decorated with Pydantic's dataclass.

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

Option B — Safe version pin Backward-compatible pin

pip install pydantic==2.5

When NOT to use: Do not use if you need features or security fixes in newer releases.

Use when you can’t upgrade immediately. Plan a follow-up to upgrade (pins can accumulate security/compat debt).

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

First fixed release: 2.6.1

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 applied if the base class is not decorated with Pydantic's dataclass.
  • Do not use if you need features or security fixes in newer releases.

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
2.5 Working
2.6.1 Fixed

Related Issues

No related fixes found.

Sources

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