The Fix
pip install pydantic==1.10.18
Based on closed pydantic/pydantic issue #9901 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -83,6 +83,7 @@ is desired, you can switch to `left-to-right` mode and change the order of your
* Add more robust custom validation examples by @ChrisPappalardo in [#9468](https://github.com/pydantic/pydantic/pull/9468)
* Fix ignored `strict` specification for `StringConstraint(strict=False)` by @vbmendes in [#9476](https://github.com/pydantic/pydantic/pull/9476)
+* **Breaking Change:** Use PEP 570 syntax by @Viicos in [#9479](https://github.com/pydantic/pydantic/pull/9479)
* Use `Self` where possible by @Viicos in [#9479](https://github.com/pydantic/pydantic/pull/9479)
* Do not alter `RootModel.model_construct` signature in the `mypy` plugin by @Viicos in [#9480](https://github.com/pydantic/pydantic/pull/9480)
pydantic version: 2.7.4
pydantic-core version: 2.18.4
pydantic-core build: profile=release pgo=true
install path: C:\Users\fraser\.virtualenvs\render-services-IYdnVPWc\Lib\site-packages\pydantic
python version: 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
platform: Windows-10-10.0.22631-SP0
related packages: fastapi-0.111.0 mypy-1.8.0 typing_extensions-4.12.2
commit: unknown
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 backward compatibility for __model_name is required.\n\n
Why This Fix Works in Production
- Trigger: v2.8 create_model breaking change to api (__model_name->model_name), not in changelog
- Mechanism: The change to create_model introduced a breaking change by altering the parameter name from __model_name to model_name
- Why the fix works: Updated the changelog to reflect breaking changes regarding PEP 570, which affects the create_model function. (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
- The change to create_model introduced a breaking change by altering the parameter name from __model_name to model_name
- Production symptom (often without a traceback): v2.8 create_model breaking change to api (__model_name->model_name), not in changelog
Proof / Evidence
- GitHub issue: #9901
- Fix PR: https://github.com/pydantic/pydantic/pull/9903
- 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.48
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“The change added / to the signature, might I suggest also adding __model_name as a kw arg deprecated just for back compat - that should…”
“> Do you have a use case where replacing create_model(__model_name=...) by create_model(...) isn't possible? Nup it's obviously a niche use case (but we had it)…”
“@Viicos, thanks for opening the PR - I've approved. @fraser-langton, see https://github.com/pydantic/pydantic/issues/9810, which is a duplicate of this issue.”
“> The change added / to the signature, might I suggest also adding __model_name as a kw arg deprecated just for back compat - that…”
Failure Signature (Search String)
- v2.8 create_model breaking change to api (__model_name->model_name), not in changelog
- Interesting to find this #1367 which originally changed model_name -> __model_name
Copy-friendly signature
Failure Signature
-----------------
v2.8 create_model breaking change to api (__model_name->model_name), not in changelog
Interesting to find this #1367 which originally changed model_name -> __model_name
Error Message
Signature-only (no traceback captured)
Error Message
-------------
v2.8 create_model breaking change to api (__model_name->model_name), not in changelog
Interesting to find this #1367 which originally changed model_name -> __model_name
Minimal Reproduction
pydantic version: 2.7.4
pydantic-core version: 2.18.4
pydantic-core build: profile=release pgo=true
install path: C:\Users\fraser\.virtualenvs\render-services-IYdnVPWc\Lib\site-packages\pydantic
python version: 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
platform: Windows-10-10.0.22631-SP0
related packages: fastapi-0.111.0 mypy-1.8.0 typing_extensions-4.12.2
commit: unknown
Environment
- Pydantic: 2
What Broke
Users experienced API errors due to the breaking change in the create_model function.
Why It Broke
The change to create_model introduced a breaking change by altering the parameter name from __model_name to model_name
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.
Option D — Guard side-effects with OnceOnly Guardrail for side-effects
Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.
- Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
- Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
- Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
from onceonly import OnceOnly
import os
once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True)
# Stable idempotency key per real side-effect.
# Use a request id / job id / webhook delivery id / Stripe event id, etc.
event_id = "evt_..." # replace
key = f"stripe:webhook:{event_id}"
res = once.check_lock(key=key, ttl=3600)
if res.duplicate:
return {"status": "already_processed"}
# Safe to execute the side-effect exactly once.
handle_event(event_id)
Fix reference: https://github.com/pydantic/pydantic/pull/9903
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 backward compatibility for __model_name is required.
- Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.
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.