Vamsi-klu commented on PR #69393:
URL: https://github.com/apache/airflow/pull/69393#issuecomment-4912281706
Confirmed the root cause. The missing-DagRun branch raised a bare ValueError
inside the try that only guards `except DataError` / `except SQLAlchemyError`,
so it escaped to the app-level catch-all in execution_api/app.py
(@app.exception_handler(Exception)), which returns a raw 500 {"message":
"Internal server error"}. Raising HTTPException(status_code=404,
detail={"reason": "not_found", ...}) instead is routed to Starlette's dedicated
HTTPException handler and renders a clean 404. HTTPException and status are
already imported, and the {"reason": "not_found", "message": ...} detail shape
matches the other 404s in this file, so it's consistent with the module's
convention. Two notes: (1) this branch is defensive -- a TaskInstance's run_id
is FK-bound to a DagRun, so dr being None shouldn't happen in a consistent DB;
the change is correct regardless, just low blast-radius. (2) There's no test on
this path. A small regression test reaching ti_run with the DagRun absent and
asserting 4
04 with this payload would pin the behavior against a regression back to 500
-- you may need to force the dr-is-None condition directly (e.g. patch the
DagRun lookup), since the FK makes it hard to set up naturally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]