The Fix
pip install pydantic==2.11.8
Based on closed pydantic/pydantic issue #9057 · 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%.
@@ -501,3 +501,49 @@ args, kwargs = val.validate_json('{"args": ["arg1"], "kwargs": {"extra": 1}}')
#> ('arg1',) {'extra': 1}
```
+
+## `MISSING` sentinel
+
import json
from typing import NotRequired
from pydantic import TypeAdapter
from typing_extensions import TypedDict
class Cell(TypedDict):
name: str
type: str
organism: NotRequired[str]
ta = TypeAdapter(Cell)
print(json.dumps(ta.json_schema()))
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.8\nWhen NOT to use: Do not use this fix if you need strict validation without optional fields.\n\n
Why This Fix Works in Production
- Trigger: Pydantic to JSON Schema translation: Write a field with no default value that is not required in the JSON schema
- Mechanism: The Pydantic model requires default values for fields to be excluded from JSON schema requirements
- Why the fix works: Introduced an experimental `MISSING` sentinel to allow fields without default values to be excluded from JSON schema requirements. (first fixed release: 2.11.8).
- 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
- The Pydantic model requires default values for fields to be excluded from JSON schema requirements
- Production symptom (often without a traceback): Pydantic to JSON Schema translation: Write a field with no default value that is not required in the JSON schema
Proof / Evidence
- GitHub issue: #9057
- Fix PR: https://github.com/pydantic/pydantic/pull/11883
- First fixed release: 2.11.8
- 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.68
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“#8394 is similar, but I'm referring here specifically to the JSON schema generator”
“Maybe TypedDict is what you need. **JSON Schema**:”
“A new MISSING sentinel was introduced in https://github.com/pydantic/pydantic/pull/11883 as an experimental feature, and available to be tested in the 2.12.0a1 release”
Failure Signature (Search String)
- Pydantic to JSON Schema translation: Write a field with no default value that is not required in the JSON schema
- Consider the following schema:
Copy-friendly signature
Failure Signature
-----------------
Pydantic to JSON Schema translation: Write a field with no default value that is not required in the JSON schema
Consider the following schema:
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Pydantic to JSON Schema translation: Write a field with no default value that is not required in the JSON schema
Consider the following schema:
Minimal Reproduction
import json
from typing import NotRequired
from pydantic import TypeAdapter
from typing_extensions import TypedDict
class Cell(TypedDict):
name: str
type: str
organism: NotRequired[str]
ta = TypeAdapter(Cell)
print(json.dumps(ta.json_schema()))
Environment
- Pydantic: 2.6.4
What Broke
Users cannot create optional fields in JSON schema without default values, leading to incorrect form behavior.
Why It Broke
The Pydantic model requires default values for fields to be excluded from JSON schema requirements
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.11.8
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/11883
First fixed release: 2.11.8
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if you need strict validation without optional fields.
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.8 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.