The Fix
pip install pydantic==2.10.4
Based on closed pydantic/pydantic issue #11076 · 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.
@@ -1197,7 +1197,9 @@ except PydanticUserError as exc_info:
## Unsupported type for `validate_call` {#validate-call-type}
-`validate_call` has some limitations on the callables it can validate. This error is raised when you try to use it with an unsupported callable. Currently the supported callables are functions (including lambdas) and methods and instances of [`partial`][functools.partial]. In the case of [`partial`][functools.partial], the function being partially applied must be one of the supported callables.
+`validate_call` has some limitations on the callables it can validate. This error is raised when you try to use it with an unsupported callable.
+Currently the supported callables are functions (including lambdas, but not built-ins) and methods and instances of [`partial`][functools.partial].
from __future__ import annotations
import dataclasses
import typing
import uuid
from datetime import timedelta
import pydantic.dataclasses
@pydantic.dataclasses.dataclass(kw_only=True)
class SqsSendMessageBatchRequestEntry:
id: str = dataclasses.field(default_factory=lambda: str(uuid.uuid4()))
delay: timedelta = None
msg_attrs: dict = dataclasses.field(default_factory=lambda: {})
msg_sys_attrs: dict = dataclasses.field(default_factory=lambda: {})
msg_dedupe_id: str = None
msg_group_id: str = None
@pydantic.validate_call
def sqs_send_message_batch[T: (SqsSendMessageBatchRequestEntry, str, dict)](
queue_name_or_url: str,
entries: T|typing.Iterable[T],
):
pass
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.10.4\nWhen NOT to use: This fix should not be applied if the codebase does not utilize PEP 695 type parameters.\n\n
Why This Fix Works in Production
- Trigger: pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined when using from __future__ import annotations with a genetic function
- Mechanism: The error occurs due to improper handling of PEP 695 type parameters in generic functions
- Why the fix works: Addresses the issue of PydanticUndefinedAnnotation when using from __future__ import annotations with a generic function. (first fixed release: 2.10.4).
- 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 error occurs due to improper handling of PEP 695 type parameters in generic functions
- Production symptom (often without a traceback): pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined when using from __future__ import annotations with a genetic function
Proof / Evidence
- GitHub issue: #11076
- Fix PR: https://github.com/pydantic/pydantic/pull/11093
- First fixed release: 2.10.4
- 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.43
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“### Initial Checks - [X] I confirm that I'm using Pydantic V2 ### Description Running the below code fails with **pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined** It works just fine in 2.9.2, if that helps. ### Example”
Failure Signature (Search String)
- pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined when using from __future__ import annotations with a genetic function
- Running the below code fails with **pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined**
Copy-friendly signature
Failure Signature
-----------------
pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined when using from __future__ import annotations with a genetic function
Running the below code fails with **pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined**
Error Message
Signature-only (no traceback captured)
Error Message
-------------
pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined when using from __future__ import annotations with a genetic function
Running the below code fails with **pydantic.errors.PydanticUndefinedAnnotation: name 'T' is not defined**
Minimal Reproduction
from __future__ import annotations
import dataclasses
import typing
import uuid
from datetime import timedelta
import pydantic.dataclasses
@pydantic.dataclasses.dataclass(kw_only=True)
class SqsSendMessageBatchRequestEntry:
id: str = dataclasses.field(default_factory=lambda: str(uuid.uuid4()))
delay: timedelta = None
msg_attrs: dict = dataclasses.field(default_factory=lambda: {})
msg_sys_attrs: dict = dataclasses.field(default_factory=lambda: {})
msg_dedupe_id: str = None
msg_group_id: str = None
@pydantic.validate_call
def sqs_send_message_batch[T: (SqsSendMessageBatchRequestEntry, str, dict)](
queue_name_or_url: str,
entries: T|typing.Iterable[T],
):
pass
Environment
- Pydantic: 2
What Broke
Users experience crashes when using generic functions with annotations, leading to application downtime.
Why It Broke
The error occurs due to improper handling of PEP 695 type parameters in generic functions
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.10.4
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/11093
First fixed release: 2.10.4
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the codebase does not utilize PEP 695 type parameters.
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.10.4 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.