Skip to content

Fix airflowctl traceback when a proxy returns a non-JSON error - #71424

Closed
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:ctl-non-json-error-traceback
Closed

Fix airflowctl traceback when a proxy returns a non-JSON error#71424
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:ctl-non-json-error-traceback

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

safe_call_command catches ServerResponseError but not the httpx.HTTPStatusError it inherits from, and only a JSON error body ever becomes a ServerResponseError. Every other error response therefore escapes as an unhandled exception, and the user gets a traceback where a message belongs.

Those responses come from whatever sits in front of the API server rather than from Airflow — a reverse proxy returning its own text/html 502 during a restart, or an SSO gateway answering with a login page. Since the traceback names httpx, it reads as a client bug. The command now exits 1 with the status and the response's content type, enough to place the blame correctly.

Independent of #70936, which widens the media-type check in the API client.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

Only a JSON error body is turned into a ServerResponseError, so an error
page from a reverse proxy or gateway sitting in front of the API server
reached the user as an unhandled exception with no indication of where the
response actually came from.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant