The Fix
pip install pydantic==1.10.15
Based on closed pydantic/pydantic issue #9098 · 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%.
@@ -93,7 +93,7 @@ def __new__(
namespace, config_wrapper.ignored_types, class_vars, base_field_names
)
- if private_attributes:
+ if private_attributes or base_private_attributes:
original_model_post_init = get_model_post_init(namespace, bases)
Option A — Upgrade to fixed release\npip install pydantic==1.10.15\nWhen NOT to use: This fix is not applicable if private attributes are not used in the model.\n\n
Why This Fix Works in Production
- Trigger: Using a private attribute in model_post_init of subclass
- Mechanism: Initializes private attributes from supertypes in the model_post_init method, addressing the issue where accessing a private attribute before calling super().model_post_init raises a TypeError.
- Why the fix works: Initializes private attributes from supertypes in the model_post_init method, addressing the issue where accessing a private attribute before calling super().model_post_init raises a TypeError. (first fixed release: 1.10.15).
- 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.10 in real deployments (not just unit tests).
- Surfaces as: Traceback:
Proof / Evidence
- GitHub issue: #9098
- Fix PR: https://github.com/pydantic/pydantic/pull/9134
- First fixed release: 1.10.15
- 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.72
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“This fix will be released with 2.7 early next week :).”
“At a first glance, looks similar to https://github.com/pydantic/pydantic/issues/7293, which I thought we fixed...”
“@Viicos, any insight on what we should do here? I'm wondering why we don't have a check for if private_attributes or base_private_attributes here, but perhaps…”
“> At a first glance, looks similar to #7293, which I thought we fixed... Oh that one was from me as well :D it's different…”
Failure Signature (Search String)
- Using a private attribute in model_post_init of subclass
Error Message
Stack trace
Error Message
-------------
Traceback:
Stack trace
Error Message
-------------
TypeError: 'NoneType' object is not subscriptable
Environment
- Python: 3.10
- Pydantic: 2
What Broke
The application raises a TypeError when initializing a subclass model with private attributes.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.15
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/9134
First fixed release: 1.10.15
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if private attributes are not used in the model.
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.15 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.