Jump to solution
Verify

The Fix

pip install pydantic==2.11.0

Based on closed pydantic/pydantic issue #11557 · 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
@@ -1449,20 +1449,14 @@ def _literal_schema(self, literal_type: Any) -> CoreSchema: def _typed_dict_schema(self, typed_dict_cls: Any, origin: Any) -> core_schema.CoreSchema: - """Generate schema for a TypedDict. + """Generate a core schema for a `TypedDict` class.
repro.py
# /// script # requires-python = ">=3.13" # dependencies = ["pydantic==2.11.0b1"] # /// from __future__ import annotations # !! removing this or downgrading to 2.10.6 fixes it from pydantic import BaseModel from typing import TypedDict, NotRequired class MetadataDict(TypedDict): title: NotRequired[str] class Message(BaseModel): content: str metadata: MetadataDict | None = None print(Message(content="test", metadata={}))
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.11.0\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: __future__ annotations + TypedDict NotRequired broken in 2.11.0b1
  • Mechanism: Fixes the issue where the `NotRequired` qualifier was not taken into account in stringified annotations for TypedDicts in Pydantic 2.11.0b1.
  • Why the fix works: Fixes the issue where the `NotRequired` qualifier was not taken into account in stringified annotations for TypedDicts in Pydantic 2.11.0b1. (first fixed release: 2.11.0).
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.13 in real deployments (not just unit tests).
  • Production symptom (often without a traceback): __future__ annotations + TypedDict NotRequired broken in 2.11.0b1

Proof / Evidence

Discussion

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

“Thanks for the bug report, I'm surprised the regression wasn't properly caught by our test suite. I'll provide a fix.”
@Viicos · 2025-03-14 · source

Failure Signature (Search String)

  • __future__ annotations + TypedDict NotRequired broken in 2.11.0b1
  • Hi, using a `TypedDict` with `NotRequired` in a model fails validation in Pydantic 2.11.0b1 but works in Pydantic 2.10.6. It only breaks when `from __future__ import annotations`
Copy-friendly signature
signature.txt
Failure Signature ----------------- __future__ annotations + TypedDict NotRequired broken in 2.11.0b1 Hi, using a `TypedDict` with `NotRequired` in a model fails validation in Pydantic 2.11.0b1 but works in Pydantic 2.10.6. It only breaks when `from __future__ import annotations` is set up.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- __future__ annotations + TypedDict NotRequired broken in 2.11.0b1 Hi, using a `TypedDict` with `NotRequired` in a model fails validation in Pydantic 2.11.0b1 but works in Pydantic 2.10.6. It only breaks when `from __future__ import annotations` is set up.

Minimal Reproduction

repro.py
# /// script # requires-python = ">=3.13" # dependencies = ["pydantic==2.11.0b1"] # /// from __future__ import annotations # !! removing this or downgrading to 2.10.6 fixes it from pydantic import BaseModel from typing import TypedDict, NotRequired class MetadataDict(TypedDict): title: NotRequired[str] class Message(BaseModel): content: str metadata: MetadataDict | None = None print(Message(content="test", metadata={}))

Environment

  • Python: 3.13
  • Pydantic: 2

What Broke

Validation fails when using TypedDict with NotRequired under future annotations, causing incorrect behavior.

Fix Options (Details)

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

pip install pydantic==2.11.0

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

First fixed release: 2.11.0

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
2.11.0 Broken
2.11.0 Fixed

Related Issues

No related fixes found.

Sources

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