The Fix
pip install pydantic==1.10.19
Based on closed pydantic/pydantic issue #9789 · 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.
@@ -372,21 +372,12 @@ jobs:
test-typing-extensions:
- name: test typing-extensions ${{ matrix.typing-extensions-version }} on Python ${{ matrix.python-version }}
+ name: test typing-extensions (`main` branch) on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
from pydantic import BaseModel, model_validator
from typing import Optional
class APIConfig(BaseModel):
base_url: str = "pydantic.dev"
api_url: Optional[str] = None
@model_validator(mode='after')
def set_api_url(self):
if self.api_url is None:
self.api_url = f"api.{self.base_url}"
return self
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.19\nWhen NOT to use: This fix should not be used if the model's default values do not depend on other fields.\n\nOption C — Workaround\n```python\nWhen NOT to use: This fix should not be used if the model's default values do not depend on other fields.\n\n
Why This Fix Works in Production
- Trigger: - [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
- Mechanism: The current implementation does not allow default values to depend on other field values
- Why the fix works: Introduces support for default factories that can take validated data as an argument, allowing for more dynamic default value computation in Pydantic models. (first fixed release: 1.10.19).
- 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 current implementation does not allow default values to depend on other field values
- Production symptom (often without a traceback): - [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
Proof / Evidence
- GitHub issue: #9789
- Fix PR: https://github.com/pydantic/pydantic/pull/10678
- First fixed release: 1.10.19
- 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.60
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@Viicos so in this case. Do you think we should support both _default_1 and _default_2 or just _default_1 will work after this feature added ?…”
“Hi folks! Thanks for the detailed feature requests here”
“+1 For the context aware default factory or some variation of it.”
“@Viicos @aaazzam So I think this could be a bit interesting problem here”
Failure Signature (Search String)
- - [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
- - [X] [Data validation/parsing](https://docs.pydantic.dev/concepts/models/#basic-model-usage)
Copy-friendly signature
Failure Signature
-----------------
- [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
- [X] [Data validation/parsing](https://docs.pydantic.dev/concepts/models/#basic-model-usage)
Error Message
Signature-only (no traceback captured)
Error Message
-------------
- [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
- [X] [Data validation/parsing](https://docs.pydantic.dev/concepts/models/#basic-model-usage)
Minimal Reproduction
from pydantic import BaseModel, model_validator
from typing import Optional
class APIConfig(BaseModel):
base_url: str = "pydantic.dev"
api_url: Optional[str] = None
@model_validator(mode='after')
def set_api_url(self):
if self.api_url is None:
self.api_url = f"api.{self.base_url}"
return self
What Broke
Users face limitations in setting dynamic default values based on other fields.
Why It Broke
The current implementation does not allow default values to depend on other field values
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.19
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Option C — Workaround Temporary workaround
```python
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Fix reference: https://github.com/pydantic/pydantic/pull/10678
First fixed release: 1.10.19
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the model's default values do not depend on other fields.
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.19 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.