Jump to solution
Verify

The Fix

pip install pydantic==2.9.1

Based on closed pydantic/pydantic issue #9567 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -1057,6 +1057,10 @@ print(type(Meal(dessert={'kind': 'cake'}).dessert).__name__) Allows any value, including `None`. +## [`typing.Hashable`][] + +* From Python, supports any data that passes an `isinstance(v, Hashable)` check.
repro.py
from typing import Hashable from pydantic import BaseModel class A(BaseModel): x: Hashable a = A.model_validate_json('{"x": "1"}')
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: Do not use this fix if your application relies on non-hashable types being validated.\n\n

Why This Fix Works in Production

  • Trigger: `model_validate_json` cannot validate `Hashable`
  • Mechanism: The validation for Hashable types in JSON was not implemented in the library
  • Why the fix works: Adds support for validating `Hashable` types in JSON, addressing the issue reported in #9567. (first fixed release: 2.9.1).

Why This Breaks in Prod

  • The validation for Hashable types in JSON was not implemented in the library
  • Production symptom (often without a traceback): `model_validate_json` cannot validate `Hashable`

Proof / Evidence

Discussion

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

“@uf-fipper, Thanks for the report, looks like a bug (or maybe a feature request, not sure if we ever supported this).”
@sydney-runkle · 2024-06-05 · source

Failure Signature (Search String)

  • `model_validate_json` cannot validate `Hashable`
Copy-friendly signature
signature.txt
Failure Signature ----------------- `model_validate_json` cannot validate `Hashable`

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- `model_validate_json` cannot validate `Hashable`

Minimal Reproduction

repro.py
from typing import Hashable from pydantic import BaseModel class A(BaseModel): x: Hashable a = A.model_validate_json('{"x": "1"}')

Environment

  • Pydantic: 2

What Broke

Users experienced validation errors when trying to validate Hashable types in JSON.

Why It Broke

The validation for Hashable types in JSON was not implemented in the library

Fix Options (Details)

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

pip install pydantic==2.9.1

When NOT to use: Do not use this fix if your application relies on non-hashable types being validated.

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

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

  • Do not use this fix if your application relies on non-hashable types being validated.

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.