Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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={}
repro.py
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)
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.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).
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

  • 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

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”
Issue thread · issue description · source

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
signature.txt
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.txt
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

repro.py
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

When NOT to use: Do not use this fix if the schema_generator is not intended for your use case.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if the schema_generator is not intended for your use case.

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.0 Fixed

Related Issues

No related fixes found.

Sources

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