The Fix
pip install pydantic==2.9.0
Based on closed pydantic/pydantic issue #9289 · 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%.
@@ -98,7 +98,9 @@ def _get_schema(type_: Any, config_wrapper: _config.ConfigWrapper, parent_depth:
global_ns = sys._getframe(max(parent_depth - 1, 1)).f_globals.copy()
global_ns.update(local_ns or {})
- gen = _generate_schema.GenerateSchema(config_wrapper, types_namespace=global_ns, typevars_map={})
+ gen = (config_wrapper.schema_generator or _generate_schema.GenerateSchema)(
+ config_wrapper, types_namespace=global_ns, typevars_map={}
from typing import Any
from pydantic_core import core_schema
from pydantic import RootModel
from pydantic._internal._generate_schema import GenerateSchema
from pydantic.config import ConfigDict
class MyGenerateSchema(GenerateSchema):
def _unknown_type_schema(self, obj: Any):
return core_schema.int_schema()
class MyType:
pass
class MyModel(RootModel):
model_config = ConfigDict(schema_generator=MyGenerateSchema)
root: MyType
debug(MyModel('123').root)
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.9.0\nWhen NOT to use: Do not use this fix if the schema_generator is not intended for your use case.\n\n
Why This Fix Works in Production
- Trigger: `TypeAdapter` doesn't respect `config['schema_generator']`
- Mechanism: The TypeAdapter was not utilizing the schema_generator configuration value as intended
- Why the fix works: Respects the `schema_generator` config value in `TypeAdapter`, addressing issue #9289. (first fixed release: 2.9.0).
- 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 TypeAdapter was not utilizing the schema_generator configuration value as intended
- Production symptom (often without a traceback): `TypeAdapter` doesn't respect `config['schema_generator']`
Proof / Evidence
- GitHub issue: #9289
- Fix PR: https://github.com/pydantic/pydantic/pull/10300
- First fixed release: 2.9.0
- 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.47
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“### Initial Checks - [X] I confirm that I'm using Pydantic V2 ### Description https://github.com/pydantic/pydantic/blob/77b0e1ccd775c101be28b5dfa56bc36f1eed7eca/pydantic/type_adapter.py#L80 We're not using [config['schema_generator']](https”
Failure Signature (Search String)
- `TypeAdapter` doesn't respect `config['schema_generator']`
- We're not using [`config['schema_generator']`](https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.schema_generator), we should.
Copy-friendly signature
Failure Signature
-----------------
`TypeAdapter` doesn't respect `config['schema_generator']`
We're not using [`config['schema_generator']`](https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.schema_generator), we should.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
`TypeAdapter` doesn't respect `config['schema_generator']`
We're not using [`config['schema_generator']`](https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.schema_generator), we should.
Minimal Reproduction
from typing import Any
from pydantic_core import core_schema
from pydantic import RootModel
from pydantic._internal._generate_schema import GenerateSchema
from pydantic.config import ConfigDict
class MyGenerateSchema(GenerateSchema):
def _unknown_type_schema(self, obj: Any):
return core_schema.int_schema()
class MyType:
pass
class MyModel(RootModel):
model_config = ConfigDict(schema_generator=MyGenerateSchema)
root: MyType
debug(MyModel('123').root)
Environment
- Pydantic: 2
What Broke
The application fails to generate schemas correctly, leading to potential data validation issues.
Why It Broke
The TypeAdapter was not utilizing the schema_generator configuration value as intended
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.9.0
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/10300
First fixed release: 2.9.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the schema_generator is not intended for your use case.
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.9.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.