Jump to solution
Verify

The Fix

pip install pydantic==2.9.2

Based on closed pydantic/pydantic issue #10370 · 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%.

Jump to Verify Open PR/Commit
@@ -3,6 +3,7 @@ import functools +import inspect from typing import TYPE_CHECKING, Any, Callable, TypeVar, overload
repro.py
import asyncio import inspect from pydantic import validate_call @validate_call(validate_return=True) async def delay_number(n: int) -> int: await asyncio.sleep(1) return n if __name__ == "__main__": print(inspect.iscoroutinefunction(delay_number))
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install pydantic==2.9.2\nWhen NOT to use: This fix should not be used if the decorator is not intended for async functions.\n\n

Why This Fix Works in Production

  • Trigger: When I use `async_to_sync`, I got a error ` UserWarning: async_to_sync was passed a non-async-marked callable`.
  • Mechanism: Ensures that the `@validate_call` decorator correctly identifies and works with async functions, allowing `inspect.iscoroutinefunction` to return True for decorated coroutines.
  • Why the fix works: Ensures that the `@validate_call` decorator correctly identifies and works with async functions, allowing `inspect.iscoroutinefunction` to return True for decorated coroutines. (first fixed release: 2.9.2).
Production impact:
  • 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

  • Production symptom (often without a traceback): When I use `async_to_sync`, I got a error ` UserWarning: async_to_sync was passed a non-async-marked callable`.

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Maybe pydantic._internal._validate_call.ValidateCallWrapper need some changes to adapt async function(coroutine)?”
@MovisLi · 2024-09-10 · source
“Yeah. I don't think it's likely that we'll support async functions in the short term, but we can leave this open as a potential feature.”
@sydney-runkle · 2024-09-10 · source
“Huh, I forgot that we offered support! That's great, thanks for the ref! I'd say we probably want to have the functions defined within this…”
@sydney-runkle · 2024-09-10 · source
“> Yeah”
@MovisLi · 2024-09-10 · source

Failure Signature (Search String)

  • When I use `async_to_sync`, I got a error ` UserWarning: async_to_sync was passed a non-async-marked callable`.
  • Maybe `pydantic._internal._validate_call.ValidateCallWrapper` need some changes to adapt async function(coroutine)?
Copy-friendly signature
signature.txt
Failure Signature ----------------- When I use `async_to_sync`, I got a error ` UserWarning: async_to_sync was passed a non-async-marked callable`. Maybe `pydantic._internal._validate_call.ValidateCallWrapper` need some changes to adapt async function(coroutine)?

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- When I use `async_to_sync`, I got a error ` UserWarning: async_to_sync was passed a non-async-marked callable`. Maybe `pydantic._internal._validate_call.ValidateCallWrapper` need some changes to adapt async function(coroutine)?

Minimal Reproduction

repro.py
import asyncio import inspect from pydantic import validate_call @validate_call(validate_return=True) async def delay_number(n: int) -> int: await asyncio.sleep(1) return n if __name__ == "__main__": print(inspect.iscoroutinefunction(delay_number))

Environment

  • Pydantic: 2

What Broke

Using async_to_sync with decorated async functions results in a UserWarning and incorrect behavior.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==2.9.2

When NOT to use: This fix should not be used if the decorator is not intended for async functions.

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/10374

First fixed release: 2.9.2

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if the decorator is not intended for async functions.

Verify Fix

verify
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

VersionStatus
2.9.2 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.