The Fix
pip install pydantic==2.9.2
Based on closed pydantic/pydantic issue #10335 · 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%.
@@ -700,7 +700,7 @@ print(t.model_dump(include={'id': True, 'user': {'id'}}))
```
-The `True` indicates that we want to exclude or include an entire key, just as if we included it in a set.
+Using `True` indicates that we want to exclude or include an entire key, just as if we included it in a set (note that using `False` isn't supported).
This can be done at any depth level.
from pydantic import BaseModel
class Simple(BaseModel):
a: int
Simple(a=1).model_dump(include={'a': False})
#> {'a': 1}
# 'a': False was ignored
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==2.9.2\nWhen NOT to use: This fix should not be used if the intention is to allow `False` in the `include` argument.\n\n
Why This Fix Works in Production
- Trigger: `include`/`exclude` doesn't work when using `False`
- Mechanism: The `include` argument in `model_dump` incorrectly accepted `False`, leading to unexpected behavior
- Why the fix works: Fixes the variance issue in the `_IncEx` type alias by only allowing `True` as a valid value for inclusion in model dumps. (first fixed release: 2.9.2).
- 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 `include` argument in `model_dump` incorrectly accepted `False`, leading to unexpected behavior
- Production symptom (often without a traceback): `include`/`exclude` doesn't work when using `False`
Proof / Evidence
- GitHub issue: #10335
- Fix PR: https://github.com/pydantic/pydantic/pull/10414
- First fixed release: 2.9.2
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.61
Verified Execution
We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.
- Status: PASS
- Ran: 2026-02-11T16:52:29Z
- Package: pydantic
- Fixed: 2.9.2
- Mode: fixed_only
- Outcome: ok
Logs
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“We decided to change the type annotation to only allow Literal[True]. Probably also switching to Mapping (https://github.com/pydantic/pydantic/issues/10333#issuecomment-2343387221).”
“We've deprecated include for the Field() constructor, probably makes sense to do the same for model_dump_xxx. Important question - can we do this in v2?”
“> probably makes sense to do the same for model_dump_xxx”
“> Using include in model_dump* is semantically different: only the fields specified will be included, and the others will be excluded”
Failure Signature (Search String)
- `include`/`exclude` doesn't work when using `False`
- Ahh right, I forgot about this behavioral difference. So we can't remove it then. Let's chat tomorrow re next steps here - happy to help make this API more consistent.
Copy-friendly signature
Failure Signature
-----------------
`include`/`exclude` doesn't work when using `False`
Ahh right, I forgot about this behavioral difference. So we can't remove it then. Let's chat tomorrow re next steps here - happy to help make this API more consistent.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
`include`/`exclude` doesn't work when using `False`
Ahh right, I forgot about this behavioral difference. So we can't remove it then. Let's chat tomorrow re next steps here - happy to help make this API more consistent.
Minimal Reproduction
from pydantic import BaseModel
class Simple(BaseModel):
a: int
Simple(a=1).model_dump(include={'a': False})
#> {'a': 1}
# 'a': False was ignored
Environment
- Pydantic: 2
What Broke
Users experienced incorrect serialization results when using `False` in the `include` argument.
Why It Broke
The `include` argument in `model_dump` incorrectly accepted `False`, leading to unexpected behavior
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.9.2
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/10414
First fixed release: 2.9.2
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the intention is to allow `False` in the `include` argument.
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 |
|---|---|
| 2.9.2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.