The Fix
pip install pydantic==2.6.0
Based on closed pydantic/pydantic issue #8530 · PR/commit linked
@@ -1319,8 +1319,12 @@ print(error_locations)
## Required fields
-To declare a field as required, you may declare it using just an annotation, or you may use `Ellipsis`/`...`
-as the value:
+To declare a field as required, you may declare it using an annotation, or an annotation in combination with a `Field` specification.
from pydantic import validate_call
@validate_call
def validate_foo(a: int, b: int):
def foo():
print("Inside foo")
return a + b
return foo
def main():
foo = validate_foo(a=1, b=2)
print("Before calling foo")
print(foo())
main()
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==2.6.0\nWhen NOT to use: This fix is not applicable if pre-validation is not required for your function calls.\n\nOption C — Workaround\nto the docs.\nWhen NOT to use: This fix is not applicable if pre-validation is not required for your function calls.\n\n
Why This Fix Works in Production
- Trigger: A solution right now is to create BaseModel that copy the function signature, but this is done manually so it take time and is error prone.
- Mechanism: The validate_call feature did not support pre-validation of function arguments before execution
- Why the fix works: Added documentation for validating function arguments before calling the function, addressing issue #8530. (first fixed release: 2.6.0).
Why This Breaks in Prod
- The validate_call feature did not support pre-validation of function arguments before execution
- Production symptom (often without a traceback): A solution right now is to create BaseModel that copy the function signature, but this is done manually so it take time and is error prone.
Proof / Evidence
- GitHub issue: #8530
- Fix PR: https://github.com/pydantic/pydantic/pull/8645
- First fixed release: 2.6.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.70
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.63
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@samsja, Thanks for suggesting this feature”
“Here's an approach you can take right now:”
“@samsja, Great! Glad to hear you worked it out”
“TBC I think it'd be better to document an example similar to https://github.com/pydantic/pydantic/issues/8530#issuecomment-1885573821 rather than suggesting people write code involving things like __pydantic_validator__ which may…”
Failure Signature (Search String)
- A solution right now is to create BaseModel that copy the function signature, but this is done manually so it take time and is error prone.
- - [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
Copy-friendly signature
Failure Signature
-----------------
A solution right now is to create BaseModel that copy the function signature, but this is done manually so it take time and is error prone.
- [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
Error Message
Signature-only (no traceback captured)
Error Message
-------------
A solution right now is to create BaseModel that copy the function signature, but this is done manually so it take time and is error prone.
- [ ] [Compatibility between releases](https://docs.pydantic.dev/changelog/)
Minimal Reproduction
from pydantic import validate_call
@validate_call
def validate_foo(a: int, b: int):
def foo():
print("Inside foo")
return a + b
return foo
def main():
foo = validate_foo(a=1, b=2)
print("Before calling foo")
print(foo())
main()
What Broke
Users experienced delays due to late validation of function arguments after resource-intensive operations.
Why It Broke
The validate_call feature did not support pre-validation of function arguments before execution
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.6.0
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Option C — Workaround Temporary workaround
to the docs.
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
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/8645
First fixed release: 2.6.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if pre-validation is not required for your function calls.
- 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 |
|---|---|
| 2.6.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.