UI: Fix HTTPException import that turned a 400 into a 500 in ui/dags #67363
Merged
jason810496 merged 1 commit intoMay 23, 2026
Merged
Conversation
…g_id="~" The wrong HTTPException class (http.client.HTTPException, the stdlib base class) was imported in airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py. FastAPI's exception handlers only translate fastapi.HTTPException, so the 400 branch in get_latest_run_info propagated as 500 Internal Server Error. Import HTTPException from fastapi instead and add a regression test.
1 task
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
ui/dags.pyroute file importedHTTPExceptionfromhttp.client(the stdlib base class) instead offastapi. FastAPI's exception handlers only translatefastapi.HTTPException, so the 400-branch inget_latest_run_info(whendag_id == "~") escaped uncaught and the API returned 500 Internal Server Error instead of the intended 400 Bad Request with the documented detail message.Fix is one line: drop
from http.client import HTTPExceptionand addHTTPExceptionto the existingfrom fastapi import ...line. Added a regression test assertingGET /dags/~/latest_runreturns 400 with the expected detail body.Was generative AI tooling used to co-author this PR?
the guidelines