Jump to solution
Verify

The Fix

pip install pydantic==2.9.0

Based on closed pydantic/pydantic issue #10253 · 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
@@ -185,7 +185,7 @@ def _remove_default_globals_from_ns(namespace: dict[str, Any]) -> dict[str, Any] -def parent_frame_namespace(*, parent_depth: int = 2) -> dict[str, Any] | None: +def parent_frame_namespace(*, parent_depth: int = 2, force: bool = False) -> dict[str, Any] | None: """We allow use of items in parent namespace to get around the issue with `get_type_hints` only looking in the
repro.py
(prefect) nate :: ~/github.com/prefecthq/prefect ‹main› » prefect version | cowsay -n -f dragon ________________________________________________ / Version: 3.0.0rc20+26.g45c5e71dae \ | API version: 0.8.4 | | Python version: 3.12.5 | | Git commit: 45c5e71d | | Built: Sat, Aug 31, 2024 4:49 PM | | OS/Arch: darwin/arm64 | | Profile: bleeding | | Server type: server | \ Pydantic version: 2.9.0b2 / ------------------------------------------------ \ / \ //\ \ |\___/| / \// \\ /0 0 \__ / // | \ \ / / \/_/ // | \ \ @_^_@'/ \/_ // | \ \ //_^_/ \/_ // | \ \ ( //) | \/// | \ \ ( / /) _|_ / ) // | \ _\ ( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-. (( / / )) ,-{ _ `-.|.-~-. .~ `. (( // / )) '/\ / ~-. _ .-~ .-~^-. \ (( /// )) `. { } / \ \ (( / )) .----~-.\ \-' .~ \ `. \^-. ///.----..> \ _ -~ `. ^-` ^-_ ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ /.-~
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 apply this fix if the namespace handling is not related to model rebuilds.\n\n

Why This Fix Works in Production

  • Trigger: Hey @zzstoatzz, I just kicked off our release process for [`v2.9.0b2`](https://github.com/pydantic/pydantic/releases/tag/v2.9.0b2). Once that releases, could…
  • Mechanism: The namespace handling in model rebuilds was not correctly implemented, causing issues
  • Why the fix works: Addresses a namespace issue with model rebuilds in Pydantic, as referenced in issue #10253. (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 namespace handling in model rebuilds was not correctly implemented, causing issues
  • Production symptom (often without a traceback): Hey @zzstoatzz, I just kicked off our release process for [`v2.9.0b2`](https://github.com/pydantic/pydantic/releases/tag/v2.9.0b2). Once that releases, could you confirm that your issues are fixed by our changes in that PR?

Proof / Evidence

Discussion

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

“Hey @zzstoatzz, I just kicked off our release process for v2.9.0b2. Once that releases, could you confirm that your issues are fixed by our changes…”
@sydney-runkle · 2024-08-31 · source
“hi @sydney-runkle - can confirm! <details> <summary>notes</summary> we implemented the restricted namespace suggestion here, but even if I were to selectively undo that change, we…”
@zzstoatzz · 2024-09-02 · source

Failure Signature (Search String)

  • Hey @zzstoatzz, I just kicked off our release process for [`v2.9.0b2`](https://github.com/pydantic/pydantic/releases/tag/v2.9.0b2). Once that releases, could you confirm that your
  • we implemented the restricted namespace suggestion [here](https://github.com/PrefectHQ/prefect/pull/15117), but even if I were to selectively undo that change, we look okay on
Copy-friendly signature
signature.txt
Failure Signature ----------------- Hey @zzstoatzz, I just kicked off our release process for [`v2.9.0b2`](https://github.com/pydantic/pydantic/releases/tag/v2.9.0b2). Once that releases, could you confirm that your issues are fixed by our changes in that PR? we implemented the restricted namespace suggestion [here](https://github.com/PrefectHQ/prefect/pull/15117), but even if I were to selectively undo that change, we look okay on `v2.9.0b2`:

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Hey @zzstoatzz, I just kicked off our release process for [`v2.9.0b2`](https://github.com/pydantic/pydantic/releases/tag/v2.9.0b2). Once that releases, could you confirm that your issues are fixed by our changes in that PR? we implemented the restricted namespace suggestion [here](https://github.com/PrefectHQ/prefect/pull/15117), but even if I were to selectively undo that change, we look okay on `v2.9.0b2`:

Minimal Reproduction

repro.py
(prefect) nate :: ~/github.com/prefecthq/prefect ‹main› » prefect version | cowsay -n -f dragon ________________________________________________ / Version: 3.0.0rc20+26.g45c5e71dae \ | API version: 0.8.4 | | Python version: 3.12.5 | | Git commit: 45c5e71d | | Built: Sat, Aug 31, 2024 4:49 PM | | OS/Arch: darwin/arm64 | | Profile: bleeding | | Server type: server | \ Pydantic version: 2.9.0b2 / ------------------------------------------------ \ / \ //\ \ |\___/| / \// \\ /0 0 \__ / // | \ \ / / \/_/ // | \ \ @_^_@'/ \/_ // | \ \ //_^_/ \/_ // | \ \ ( //) | \/// | \ \ ( / /) _|_ / ) // | \ _\ ( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-. (( / / )) ,-{ _ `-.|.-~-. .~ `. (( // / )) '/\ / ~-. _ .-~ .-~^-. \ (( /// )) `. { } / \ \ (( / )) .----~-.\ \-' .~ \ `. \^-. ///.----..> \ _ -~ `. ^-` ^-_ ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ /.-~

Environment

  • Pydantic: 2.9.0

What Broke

Users experienced incorrect model behavior and potential crashes during model rebuilds.

Why It Broke

The namespace handling in model rebuilds was not correctly implemented, causing issues

Fix Options (Details)

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

pip install pydantic==2.9.0

When NOT to use: Do not apply this fix if the namespace handling is not related to model rebuilds.

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

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 apply this fix if the namespace handling is not related to model rebuilds.

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.