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%.
@@ -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
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
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==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).
- 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
- GitHub issue: #11359
- Fix PR: https://github.com/pydantic/pydantic/pull/11394
- First fixed release: 2.11.0
- 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.50
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“> Indeed for json_schema_mode_override it results in unexpected exceptions”
“> I wanted the computed fields to be always serialized Do you mean to make sure they always appear in the JSON Schema (even in…”
“> The specific documentation you linked to refers to an entirely different problem, that of multiple base classes inheritance, which is not my problem”
“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)”
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
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 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
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
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.
When NOT to Use This Fix
- This fix should not be used if configuration propagation is required for subclasses.
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 |
|---|---|
| 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.