You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Execution API leaks unhandled ValueError as 500 Internal Server Error when DagRun is missing in ti_run route #69392
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!
Activity