Skip to content
Brief Innovation & Growth ·

FastAPI 0.152.0 fixes header error names in validation messages

Errors for header models now show the real HTTP header name instead of the Python field name.

In brief
  • FastAPI 0.152.0 now names the HTTP header in header model validation errors. It shows int-val, not int_val.
  • Explicit aliases, convert_underscores=False and loc_by_alias=False keep their current behavior.

The FastAPI project published version 0.152.0 on GitHub on 20 October 2026. The release notes list one change. When a header parameter model fails validation, the error now points to the HTTP header name. The notes give an example: the error says int-val where it used to say int_val, the Python field name. The notes credit the fix to pull request 16538 by @tiangolo.

Some cases are left as they were. According to the release notes, explicit aliases keep their existing behavior. So do headers set with Header(convert_underscores=False) and Pydantic models that use loc_by_alias=False. The notes do not say how many projects this touches. They do not say whether any other changes shipped in this version. They also give no guidance on upgrading.

Teams that run FastAPI APIs and use header models may see different text in validation errors after they upgrade. Tests, logs, or client code that match on the old Python field name in error output are the places to check. The release notes describe a change to error reporting only.

A WebPulse Brief: a short report of an important event, written by the WebPulse Newsroom with AI assistance and checked against the reporting below. When there is more to explain, we follow up with a full story. How we use AI.

Reporting: GitHub (fastapi/fastapi).