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%.
@@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
+from typing import List, Dict
+from pydantic import BaseModel, ValidationError
+
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
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
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).
- 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
- GitHub issue: #9871
- Fix PR: https://github.com/pydantic/pydantic-core/pull/1373
- First fixed release: 1.10.1
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.62
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.”
“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.”
“Hi @K-dash, I was looking at the same issue, but you made it quicker:)”
“@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…”
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
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 Message
-------------
Why does it work on `x` but fails on `-x`? Is this intended behavior?
print(f"FAIL: {i}")
Minimal Reproduction
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
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.
When NOT to Use This Fix
- This fix is not applicable if using float types is required for other functionalities.
Verify Fix
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
| Version | Status |
|---|---|
| 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.