The Fix
pip install pydantic==1.10.18
Based on closed pydantic/pydantic issue #9994 · PR/commit linked
@@ -2050,10 +2050,15 @@ def handle_ref_overrides(self, json_schema: JsonSchemaValue) -> JsonSchemaValue:
def get_schema_from_definitions(self, json_ref: JsonRef) -> JsonSchemaValue | None:
- def_ref = self.json_to_defs_refs[json_ref]
- if def_ref in self._core_defs_invalid_for_json_schema:
- raise self._core_defs_invalid_for_json_schema[def_ref]
Option A — Upgrade to fixed release\npip install pydantic==1.10.18\nWhen NOT to use: This fix should not be applied if the application relies on the previous behavior of schema generation.\n\n
Why This Fix Works in Production
- Trigger: Thanks to @misrasaurabh1 from the codeflash team for the help with optimizations in the `_generate_schema.py` file!
- Mechanism: The handling of Mapping and MutableMapping annotations was incorrect, leading to schema generation issues
- Why the fix works: Fixes the handling of `Mapping` and `MutableMapping` annotations to use the correct mapping schema instead of dict schema, addressing issue #9549. (first fixed release: 1.10.18).
Why This Breaks in Prod
- The handling of Mapping and MutableMapping annotations was incorrect, leading to schema generation issues
- Production symptom (often without a traceback): Thanks to @misrasaurabh1 from the codeflash team for the help with optimizations in the `_generate_schema.py` file!
Proof / Evidence
- GitHub issue: #9994
- Fix PR: https://github.com/pydantic/pydantic/pull/9863
- First fixed release: 1.10.18
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.66
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Merged PRs as a result of this week's work: * https://github.com/pydantic/pydantic/pull/9979 * https://github.com/pydantic/pydantic/pull/9999 * https://github.com/pydantic/pydantic/pull/10003 * https://github.com/pydantic/pydantic/pull/10007 * https://github.c”
“I've updated the review queue with new PRs, will try to get through most of these by EOD today.”
“Pretty happy with this week's progress”
Failure Signature (Search String)
- Thanks to @misrasaurabh1 from the codeflash team for the help with optimizations in the `_generate_schema.py` file!
- This will be my second week focusing on improving schema build time in `pydantic`, with an emphasis on improved performance and import times for models. I anticipate this being my
Copy-friendly signature
Failure Signature
-----------------
Thanks to @misrasaurabh1 from the codeflash team for the help with optimizations in the `_generate_schema.py` file!
This will be my second week focusing on improving schema build time in `pydantic`, with an emphasis on improved performance and import times for models. I anticipate this being my last week where this is my primary focus.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Thanks to @misrasaurabh1 from the codeflash team for the help with optimizations in the `_generate_schema.py` file!
This will be my second week focusing on improving schema build time in `pydantic`, with an emphasis on improved performance and import times for models. I anticipate this being my last week where this is my primary focus.
What Broke
Users experienced schema generation failures when using external JSON Schema references.
Why It Broke
The handling of Mapping and MutableMapping annotations was incorrect, leading to schema generation issues
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.18
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/9863
First fixed release: 1.10.18
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the application relies on the previous behavior of schema generation.
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.
- Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
- Add a long-running test that repeats the failing call path and asserts stable memory.
Version Compatibility Table
| Version | Status |
|---|---|
| 1.10.18 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.