pierrejeambrun opened a new pull request, #72890:
URL: https://github.com/apache/airflow/pull/72890

   The Execution API `ti_run` route raised a bare `ValueError` when the DagRun 
for a task instance could not be found. That `try` block only guards 
`DataError` and `SQLAlchemyError`, so the `ValueError` escaped to the app-level 
`Exception` handler and the caller received an opaque `500 {"message": 
"Internal server error"}`.
   
   A missing resource should be reported as a `404`. This replaces the 
`ValueError` with an `HTTPException(404, ...)` whose RFC 9457-style `{"reason": 
"not_found", "message": ...}` detail matches the other not-found responses in 
this route, so Starlette's `HTTPException` handler renders a clean 404.
   
   This is a defensive branch (a task instance's `run_id` is FK-bound to a 
DagRun, so `dr is None` should not occur in a consistent DB), so it is a 
low-blast-radius error-path correctness fix with a regression test.
   
   closes: #69392
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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]

Reply via email to