Jump to solution
Details

The Fix

pip install pydantic==2.6.2

Based on closed pydantic/pydantic issue #8771 · 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%.

Open PR/Commit
@@ -59,7 +59,9 @@ types: * `str`; the following formats are accepted: * `YYYY-MM-DD[T]HH:MM[:SS[.ffffff]][Z or [±]HH[:]MM]` + * `YYYY-MM-DD` is accepted in lax mode, but not in strict mode * `int` or `float` as a string (assumed as Unix time) + * [`datetime.date`][] instances are accepted in lax mode, but not in strict mode
fix.md
Option A — Upgrade to fixed release\npip install pydantic==2.6.2\nWhen NOT to use: This fix is not applicable if the documentation does not require clarification for other types.\n\n

Why This Fix Works in Production

  • Trigger: This was probably missed during the [v1 -> v2 migration](https://docs.pydantic.dev/latest/migration/#changes-to-pydanticfield)
  • Mechanism: Documentation did not clarify that min_length and max_length apply to iterables
  • Why the fix works: Updated documentation to clarify that min_length and max_length apply to iterables. (first fixed release: 2.6.2).
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

  • Documentation did not clarify that min_length and max_length apply to iterables
  • Production symptom (often without a traceback): This was probably missed during the [v1 -> v2 migration](https://docs.pydantic.dev/latest/migration/#changes-to-pydanticfield)

Proof / Evidence

Discussion

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

“Yes! @straygar iterable is more inclusive as then it is implied it works for ANY iterable (tuples, dicts, etc.)”
Issue thread · 2024-02-13 · source
“@straygar, You're correct, thanks for catching this! Could you please open a PR with a fix? I'd be happy to review your changes.”
@sydney-runkle · 2024-02-12 · source
“Sure! I guess this also applies to sets and bytes? What'd be a good generic text? Do we even want to specify types here?”
@straygar · 2024-02-13 · source
“@straygar you can use "iterable" as a catch all term here. Thanks!”
@sydney-runkle · 2024-02-13 · source

Failure Signature (Search String)

  • This was probably missed during the [v1 -> v2 migration](https://docs.pydantic.dev/latest/migration/#changes-to-pydanticfield)
  • You're correct, thanks for catching this! Could you please open a PR with a fix? I'd be happy to review your changes.
Copy-friendly signature
signature.txt
Failure Signature ----------------- This was probably missed during the [v1 -> v2 migration](https://docs.pydantic.dev/latest/migration/#changes-to-pydanticfield) You're correct, thanks for catching this! Could you please open a PR with a fix? I'd be happy to review your changes.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- This was probably missed during the [v1 -> v2 migration](https://docs.pydantic.dev/latest/migration/#changes-to-pydanticfield) You're correct, thanks for catching this! Could you please open a PR with a fix? I'd be happy to review your changes.

Environment

  • Pydantic: 2

What Broke

Users were misled by documentation, leading to incorrect usage of field parameters.

Why It Broke

Documentation did not clarify that min_length and max_length apply to iterables

Fix Options (Details)

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

pip install pydantic==2.6.2

When NOT to use: This fix is not applicable if the documentation does not require clarification for other types.

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

First fixed release: 2.6.2

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 documentation does not require clarification for other types.

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

Related Issues

No related fixes found.

Sources

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