Jump to solution
Verify

The Fix

pip install pydantic==1.10.1

Based on closed pydantic/pydantic issue #9871 · 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
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@ +from typing import List, Dict +from pydantic import BaseModel, ValidationError +
repro.py
pydantic version: 2.7.2 pydantic-core version: 2.18.3 pydantic-core build: profile=release pgo=true install path: /Users/lucas/{redacted}/venv/lib/python3.12/site-packages/pydantic python version: 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] platform: macOS-14.5-arm64-arm-64bit related packages: typing_extensions-4.12.0 fastapi-0.111.0 pydantic-settings-2.2.1 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==1.10.1\nWhen NOT to use: This fix is not applicable if using float types is required for other functionalities.\n\n

Why This Fix Works in Production

  • Trigger: Why does it work on `x` but fails on `-x`? Is this intended behavior?
  • Mechanism: Validation of negative floats with the 'multiple_of' constraint fails due to rounding issues
  • Why the fix works: Fixed a bug related to the validation of negative floats with the 'multiple_of' constraint in Pydantic. (first fixed release: 1.10.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

  • Shows up under Python 3.12 in real deployments (not just unit tests).
  • Validation of negative floats with the 'multiple_of' constraint fails due to rounding issues
  • Production symptom (often without a traceback): Why does it work on `x` but fails on `-x`? Is this intended behavior?

Proof / Evidence

Discussion

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

“Hi, I've been investigating this today, seems that using decimal.Decimal instead of float makes the trick. Results in: This should be fixed at pydantic-core though.”
@aldorvv · 2024-07-21 · confirmation · source
“Hi @AlessandroMiola Thank you for your suggestion:). I agree with your point, so I have added the same test cases to test_decimal_multiple_of as well.”
@K-dash · 2024-07-22 · source
“Hi @K-dash, I was looking at the same issue, but you made it quicker:)”
@AlessandroMiola · 2024-07-22 · source
“@plutaniano, Huh, this is definitely a bug. Thanks for reporting this! Likely an issue due to undesired rounding. A PR with a fix is more…”
@sydney-runkle · 2024-07-17 · source

Failure Signature (Search String)

  • Why does it work on `x` but fails on `-x`? Is this intended behavior?
  • print(f"FAIL: {i}")
Copy-friendly signature
signature.txt
Failure Signature ----------------- Why does it work on `x` but fails on `-x`? Is this intended behavior? print(f"FAIL: {i}")

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Why does it work on `x` but fails on `-x`? Is this intended behavior? print(f"FAIL: {i}")

Minimal Reproduction

repro.py
pydantic version: 2.7.2 pydantic-core version: 2.18.3 pydantic-core build: profile=release pgo=true install path: /Users/lucas/{redacted}/venv/lib/python3.12/site-packages/pydantic python version: 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] platform: macOS-14.5-arm64-arm-64bit related packages: typing_extensions-4.12.0 fastapi-0.111.0 pydantic-settings-2.2.1 commit: unknown

Environment

  • Python: 3.12
  • Pydantic: 2

What Broke

Negative float values fail validation unexpectedly, causing incorrect data handling.

Why It Broke

Validation of negative floats with the 'multiple_of' constraint fails due to rounding issues

Fix Options (Details)

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

pip install pydantic==1.10.1

When NOT to use: This fix is not applicable if using float types is required for other functionalities.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/pydantic/pydantic-core/pull/1373

First fixed release: 1.10.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 using float types is required for other functionalities.

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
1.10.1 Fixed

Related Issues

No related fixes found.

Sources

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