You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "KushagraB424 (via GitHub)" <gi...@apache.org> on 2026/07/04 19:02:46 UTC

[I] Bug: Execution API leaks unhandled ValueError as 500 Internal Server Error when DagRun is missing in ti_run route [airflow]

KushagraB424 opened a new issue, #69392:
URL: https://github.com/apache/airflow/issues/69392

   ### Under which category would you file this issue?
   
   Airflow Core
   
   ### Apache Airflow version
   
   main
   
   ### What happened and how to reproduce it?
   
   **Issue Description**
   In the `airflow-core` package, specifically in `airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py` inside the `ti_run` route, a domain-layer exception is currently leaking.
   
   If a `DagRun` is not found during the `ti_run` endpoint execution, the code raises a `ValueError` directly:
   `raise ValueError(f"DagRun with dag_id={ti.dag_id} and run_id={ti.run_id} not found.")`
   
   Because this `ValueError` is raised inside the route and not caught, it results in an unhandled HTTP 500 Internal Server Error being returned to the client.
   
   **Steps to reproduce:**
   Call the `PATCH /execution/task-instances/{task_instance_id}/run` endpoint with a valid `task_instance_id` where the corresponding `DagRun` does not exist in the database.
   
   
   ### What you think should happen instead?
   
   Per the Airflow coding standards, domain-layer exceptions should be translated to an `HTTPException` at FastAPI route boundaries to avoid leaking internals. 
   
   This should be replaced with:
   `raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=...)`
   
   
   ### Operating System
   
   Not Applicable
   
   ### Deployment
   
   None
   
   ### Apache Airflow Provider(s)
   
   _No response_
   
   ### Versions of Apache Airflow Providers
   
   Not Applicable
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   Not Applicable
   
   ### Helm Chart configuration
   
   Not Applicable
   
   ### Docker Image customizations
   
   Not Applicable
   
   ### Anything else?
   
    already have a fix for this and will be opening a PR shortly!
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Bug: Execution API leaks unhandled ValueError as 500 Internal Server Error when DagRun is missing in ti_run route [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun closed issue #69392: Bug: Execution API leaks unhandled ValueError as 500 Internal Server Error when DagRun is missing in ti_run route
URL: https://github.com/apache/airflow/issues/69392


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org