The Fix
pip install pydantic==1.10.20
Based on closed pydantic/pydantic issue #11641 · 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%.
@@ -11,7 +11,7 @@
from functools import lru_cache, partial
from types import FunctionType
-from typing import Any, Callable, Generic, Literal, NoReturn, TypeVar, cast
+from typing import Any, Callable, Generic, Literal, NoReturn, cast
from typing import TypeVar
from pydantic import BaseModel, RootModel
ModelT = TypeVar("ModelT", bound=BaseModel)
class RootModelIterable(RootModel[list[ModelT]]):
def __iter__(self):
"""Iterates over root items
:returns: iterator
"""
return iter(self.root)
def __getitem__(self, item: int):
"""Gets a root item by position
:param item: the position to get
:returns: item of type ModelT
"""
return self.root[item]
def __len__(self):
"""Returns the number of items.
:returns: int
"""
return len(self.root)
def append(self, item: ModelT):
self.root.append(item)
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==1.10.20\nWhen NOT to use: This fix should not be applied if the custom MRO implementation is still required for other models.\n\n
Why This Fix Works in Production
- Trigger: import RootModelIterable
- Mechanism: The custom MRO implementation of Pydantic models was removed, causing compatibility issues with generic RootModel subclasses
- Why the fix works: Removed the custom MRO implementation of Pydantic models, which is no longer necessary due to previous changes. (first fixed release: 1.10.20).
- 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.12 in real deployments (not just unit tests).
- The custom MRO implementation of Pydantic models was removed, causing compatibility issues with generic RootModel subclasses
- Surfaces as: import RootModelIterable
Proof / Evidence
- GitHub issue: #11641
- Fix PR: https://github.com/pydantic/pydantic/pull/11184
- First fixed release: 1.10.20
- 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.41
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“ah thanks for the pointer, I'll investigate in that direction. I upgraded to 2.1.1 today”
“Could you please describe what worked and what now no longer works?”
“Ah, I see you are running Pydantic 2.11.0, but your pydantic-core version is outdated (we have pinned ==* constraints for pydantic-core)”
“Oh I see, I'll try to force pydantic-core to update through version constraints”
Failure Signature (Search String)
- import RootModelIterable
Error Message
Stack trace
Error Message
-------------
import RootModelIterable
./lib/python3.12/site-packages/pydantic/_internal/_model_construction.py:237: in __new__
complete_model_class(
./lib/python3.12/site-packages/pydantic/_internal/_model_construction.py:597: in complete_model_class
schema = gen_schema.generate_schema(cls)
./lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py:699: in generate_schema
schema = self._generate_schema_inner(obj)
./lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py:977: in _generate_schema_inner
return self._model_schema(obj)
./lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py:809: in _model_schema
fields_schema: core_schema.CoreSchema = core_schema.model_fields_schema(
E TypeError: model_fields_schema() got an unexpected keyword argument 'extras_keys_schema'
Minimal Reproduction
from typing import TypeVar
from pydantic import BaseModel, RootModel
ModelT = TypeVar("ModelT", bound=BaseModel)
class RootModelIterable(RootModel[list[ModelT]]):
def __iter__(self):
"""Iterates over root items
:returns: iterator
"""
return iter(self.root)
def __getitem__(self, item: int):
"""Gets a root item by position
:param item: the position to get
:returns: item of type ModelT
"""
return self.root[item]
def __len__(self):
"""Returns the number of items.
:returns: int
"""
return len(self.root)
def append(self, item: ModelT):
self.root.append(item)
Environment
- Python: 3.12
- Pydantic: 2
What Broke
Generic RootModel subclasses fail to import, leading to test suite failures and broken functionality.
Why It Broke
The custom MRO implementation of Pydantic models was removed, causing compatibility issues with generic RootModel subclasses
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.20
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/11184
First fixed release: 1.10.20
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the custom MRO implementation is still required for other models.
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 |
|---|---|
| 1.10.20 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.