Jump to solution
Verify

The Fix

pip install pydantic==2.9.1

Based on closed pydantic/pydantic issue #10323 · 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
@@ -5,7 +5,7 @@ strategy = [] lock_version = "4.5.0" -content_hash = "sha256:45f8c82d3cadfc9650934637c003cd47f88b5cf9487a09801e06c847690abc01" +content_hash = "sha256:a35cfb3d1aa9400acb86d7b2a4727c0d4dd0998e3a00cd7cccd5d26893211f31"
repro.py
pydantic version: 2.9.0 pydantic-core version: 2.23.2 pydantic-core build: profile=release pgo=false install path: C:\Users\Galarzaa\git\tibia.py\venv\Lib\site-packages\pydantic python version: 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] platform: Windows-10-10.0.22631-SP0 related packages: fastapi-0.111.0 pydantic-settings-2.0.2 typing_extensions-4.12.2 commit: unknown
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.1\nWhen NOT to use: This fix is not applicable if the application does not require the `Not` attribute.\n\n

Why This Fix Works in Production

  • Trigger: AttributeError: module 'annotated_types' has no attrbiute 'Not'
  • Mechanism: Fixes the dependency issue by updating the required version of `annotated-types` to 0.6.0, which includes the `Not` attribute needed by Pydantic 2.9.
  • Why the fix works: Fixes the dependency issue by updating the required version of `annotated-types` to 0.6.0, which includes the `Not` attribute needed by Pydantic 2.9. (first fixed release: 2.9.1).
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

  • Surfaces as: AttributeError: module 'annotated_types' has no attrbiute 'Not'

Proof / Evidence

Discussion

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

“@sydney-runkle, I think adding a >=0.6.0 lower bound seems like the easiest way. I don't think it's worth adding safe guards (e.g. getattr(annotated_types, 'Not', None))”
@Viicos · 2024-09-05 · source

Failure Signature (Search String)

  • AttributeError: module 'annotated_types' has no attrbiute 'Not'

Error Message

Stack trace
error.txt
Error Message ------------- AttributeError: module 'annotated_types' has no attrbiute 'Not'

Minimal Reproduction

repro.py
pydantic version: 2.9.0 pydantic-core version: 2.23.2 pydantic-core build: profile=release pgo=false install path: C:\Users\Galarzaa\git\tibia.py\venv\Lib\site-packages\pydantic python version: 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] platform: Windows-10-10.0.22631-SP0 related packages: fastapi-0.111.0 pydantic-settings-2.0.2 typing_extensions-4.12.2 commit: unknown

Environment

  • Pydantic: 2.9

What Broke

Users encounter an AttributeError when using Pydantic with outdated `annotated-types`.

Fix Options (Details)

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

pip install pydantic==2.9.1

When NOT to use: This fix is not applicable if the application does not require the `Not` attribute.

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

First fixed release: 2.9.1

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 is not applicable if the application does not require the `Not` attribute.

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

Related Issues

No related fixes found.

Sources

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