The Fix
pip install pydantic==1.10.18
Based on closed pydantic/pydantic issue #9549 · 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%.
@@ -124,7 +124,7 @@
SET_TYPES: list[type] = [set, typing.Set, collections.abc.MutableSet]
FROZEN_SET_TYPES: list[type] = [frozenset, typing.FrozenSet, collections.abc.Set]
-DICT_TYPES: list[type] = [dict, typing.Dict, collections.abc.MutableMapping, collections.abc.Mapping]
+DICT_TYPES: list[type] = [dict, typing.Dict]
IP_TYPES: list[type] = [IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network]
import collections.abc
import pydantic
config = pydantic.ConfigDict(arbitrary_types_allowed=True, strict=True)
adapter = pydantic.TypeAdapter(collections.abc.MutableMapping, config=config)
adapter.validate_python(collections.UserDict())
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.18\nWhen NOT to use: This fix should not be used if strict mode validation is not required.\n\n
Why This Fix Works in Production
- Trigger: C:\code\pipelines cratch\venv\Scripts\python.exe C:\code\pipelines cratch\devtools\pydantic_userdict.py
- Mechanism: Fixes the issue where a type adapter for collections.abc.MutableMapping fails to validate instances of collections.UserDict in strict mode.
- Why the fix works: Fixes the issue where a type adapter for collections.abc.MutableMapping fails to validate instances of collections.UserDict in strict mode. (first fixed release: 1.10.18).
- 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
- Surfaces as: C:\code\pipelines\scratch\venv\Scripts\python.exe C:\code\pipelines\scratch\devtools\pydantic_userdict.py
Proof / Evidence
- GitHub issue: #9549
- Fix PR: https://github.com/pydantic/pydantic/pull/10020
- First fixed release: 1.10.18
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.36
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@sydney-runkle, I'm interested in taking a look at this. BTW, can you unassign me from #9100?”
“@hb2638, Thanks for reporting this. I can reproduce. Looks like a bug. Some more context:”
“Could be a good first issue if someone is looking to get their hands dirty with pydantic's internal validation logic. I think MutableMapping should probably…”
“In summary, I think the fix might actually be in pydantic, when we do the schema building. The way we do it is a bit…”
Failure Signature (Search String)
- C:\code\pipelines cratch\venv\Scripts\python.exe C:\code\pipelines cratch\devtools\pydantic_userdict.py
Error Message
Stack trace
Error Message
-------------
C:\code\pipelines\scratch\venv\Scripts\python.exe C:\code\pipelines\scratch\devtools\pydantic_userdict.py
Traceback (most recent call last):
File "C:\code\pipelines\scratch\devtools\pydantic_userdict.py", line 6, in <module>
adapter.validate_python(collections.UserDict())
File "C:\code\pipelines\scratch\venv\Lib\site-packages\pydantic\type_adapter.py", line 260, in validate_python
return self.validator.validate_python(object, strict=strict, from_attributes=from_attributes, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for dict[any,any]
Input should be a valid dictionary [type=dict_type, input_value={}, input_type=UserDict]
For further information visit https://errors.pydantic.dev/2.7/v/dict_type
Process finished with exit code 1
Minimal Reproduction
import collections.abc
import pydantic
config = pydantic.ConfigDict(arbitrary_types_allowed=True, strict=True)
adapter = pydantic.TypeAdapter(collections.abc.MutableMapping, config=config)
adapter.validate_python(collections.UserDict())
Environment
- Pydantic: 2
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/10020
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 used if strict mode validation is not required.
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.18 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.