Jump to solution
Verify

The Fix

pip install pydantic==2.11.0

Based on closed pydantic/pydantic issue #11359 · 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
@@ -1,70 +1,67 @@ @@ -1,70 +1,67 @@ -Behaviour of Pydantic can be controlled via the [`BaseModel.model_config`][pydantic.BaseModel.model_config], -and as an argument to [`TypeAdapter`][pydantic.TypeAdapter]. +The behaviour of Pydantic can be controlled via a variety of configuration values, documented
repro.py
from pydantic import BaseModel, ConfigDict class LLMSerializationModel(BaseModel): model_config = ConfigDict( json_schema_mode_override="serialization", ) @classmethod def model_json_schema( cls, *args, **kwargs ): schema = super().model_json_schema( *args, **kwargs, ) return schema class A(BaseModel): attr: int class B(BaseModel): a1: A a2: A class C(LLMSerializationModel): b: B a: A C.model_json_schema() # this errors C.model_json_schema(mode='validation') # this errors C.model_json_schema(mode='serialization') # this works fine
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: This fix should not be used if configuration propagation is required for subclasses.\n\n

Why This Fix Works in Production

  • Trigger: ConfigDict's json_schema_mode_override does not override default mode for model_json_schema()
  • Mechanism: The json_schema_mode_override configuration does not propagate to subclasses in Pydantic models
  • Why the fix works: Updated configuration documentation to clarify behavior regarding json_schema_mode_override. (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.11 in real deployments (not just unit tests).
  • The json_schema_mode_override configuration does not propagate to subclasses in Pydantic models
  • Production symptom (often without a traceback): ConfigDict's json_schema_mode_override does not override default mode for model_json_schema()

Proof / Evidence

Discussion

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

“> Indeed for json_schema_mode_override it results in unexpected exceptions”
@yiphei · 2025-02-13 · source
“> I wanted the computed fields to be always serialized Do you mean to make sure they always appear in the JSON Schema (even in…”
@Viicos · 2025-05-06 · source
“> The specific documentation you linked to refers to an entirely different problem, that of multiple base classes inheritance, which is not my problem”
@Viicos · 2025-02-11 · source
“The current behavior for configuration is to _not_ propagate to other classes in a model (see the documentation, which I'm adding in https://github.com/pydantic/pydantic/pull/11394)”
@Viicos · 2025-02-05 · source

Failure Signature (Search String)

  • ConfigDict's json_schema_mode_override does not override default mode for model_json_schema()
  • ConfigDict's json_schema_mode_override does not override the default mode for this particular example (see code).
Copy-friendly signature
signature.txt
Failure Signature ----------------- ConfigDict's json_schema_mode_override does not override default mode for model_json_schema() ConfigDict's json_schema_mode_override does not override the default mode for this particular example (see code).

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- ConfigDict's json_schema_mode_override does not override default mode for model_json_schema() ConfigDict's json_schema_mode_override does not override the default mode for this particular example (see code).

Minimal Reproduction

repro.py
from pydantic import BaseModel, ConfigDict class LLMSerializationModel(BaseModel): model_config = ConfigDict( json_schema_mode_override="serialization", ) @classmethod def model_json_schema( cls, *args, **kwargs ): schema = super().model_json_schema( *args, **kwargs, ) return schema class A(BaseModel): attr: int class B(BaseModel): a1: A a2: A class C(LLMSerializationModel): b: B a: A C.model_json_schema() # this errors C.model_json_schema(mode='validation') # this errors C.model_json_schema(mode='serialization') # this works fine

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

Calling model_json_schema on class C results in unexpected exceptions.

Why It Broke

The json_schema_mode_override configuration does not propagate to subclasses in Pydantic models

Fix Options (Details)

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

pip install pydantic==2.11.0

When NOT to use: This fix should not be used if configuration propagation is required for subclasses.

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

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

  • This fix should not be used if configuration propagation is required for subclasses.

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 Fixed

Related Issues

No related fixes found.

Sources

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