Skip to content

Fix DAG run trigger to surface errors instead of swallowing them#64130

Open
dstandish wants to merge 2 commits intoapache:mainfrom
dstandish:fix-dag-run-trigger-try-except
Open

Fix DAG run trigger to surface errors instead of swallowing them#64130
dstandish wants to merge 2 commits intoapache:mainfrom
dstandish:fix-dag-run-trigger-try-except

Conversation

@dstandish
Copy link
Contributor

@dstandish dstandish commented Mar 24, 2026

The trigger_dag_run endpoint had a broad try/except ValueError around create_dagrun() that silently converted any ValueError to a 400 response, hiding real errors in server logs.

This PR replaces that with targeted handling:

  • Introduces ParamValidationError (already in the SDK) to airflow.exceptions so core can catch it without importing from airflow.sdk directly
  • Changes SerializedParamsDict.validate() to raise ParamValidationError instead of ValueError
  • Catches only ParamValidationError in the endpoint (returning 400), letting all other exceptions from create_dagrun() propagate as 500s so they appear in server logs

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Sonnet 4.6

Generated-by: Claude Sonnet 4.6 following the guidelines

The try/except ValueError block around dag creation wrapped all errors
into generic 400 responses, hiding the original exception context from
logs and error tracking. Let exceptions propagate naturally so the full
traceback is preserved.
Replace broad ValueError with specific ParamValidationError in
SerializedParamsDict.validate() so the trigger_dag_run endpoint
can catch param validation errors precisely and return 400, while
letting unexpected dag run creation errors propagate as 500s.
@dstandish dstandish changed the title Remove try-except in trigger_dag_run that obfuscates errors Fix DAG run trigger to surface errors instead of swallowing them Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants