This is an automated email from the ASF dual-hosted git repository.
vatsrahul1001 pushed a commit to branch v3-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-3-test by this push:
new b7dd5e18097 [v3-3-test] Handle ValueError for `trigger_dag_run` API
request (#67601) (#70775)
b7dd5e18097 is described below
commit b7dd5e180979399fc5588ae89d936cda2e010581
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Aug 3 10:59:12 2026 +0530
[v3-3-test] Handle ValueError for `trigger_dag_run` API request (#67601)
(#70775)
(cherry picked from commit bc033da913d78983e07c64fbadff2750b3ba5cf1)
Co-authored-by: Maksim <[email protected]>
Co-authored-by: Rahul Vats <[email protected]>
---
.../api_fastapi/execution_api/routes/dag_runs.py | 8 +++++++
.../execution_api/versions/head/test_dag_runs.py | 26 ++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git
a/airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py
b/airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py
index 31aeb96c63e..00a9ab37f25 100644
--- a/airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py
+++ b/airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py
@@ -163,6 +163,14 @@ def trigger_dag_run(
status.HTTP_400_BAD_REQUEST,
detail={"reason": "invalid_partition_key", "message": str(e)},
) from e
+ except ValueError as e:
+ raise HTTPException(
+ status.HTTP_400_BAD_REQUEST,
+ detail={
+ "reason": "value_error",
+ "message": str(e),
+ },
+ ) from e
@router.post(
diff --git
a/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_dag_runs.py
b/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_dag_runs.py
index 5bd6d6b36e3..cd78af871c5 100644
---
a/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_dag_runs.py
+++
b/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_dag_runs.py
@@ -17,6 +17,7 @@
from __future__ import annotations
+import re
from unittest import mock
import pytest
@@ -322,6 +323,31 @@ class TestDagRunTrigger:
child_run = session.scalars(select(DagRun).where(DagRun.run_id ==
child_run_id)).one()
assert child_run.triggering_user_name == parent_triggering_user_name
+ def test_trigger_dag_run_value_error(self, client, session, dag_maker):
+ """Test that error is raised when a DAG Run has ValueError."""
+
+ dag_id = "test_trigger_dag_run_value_error"
+ run_id = "manual__{test_run_id}"
+ logical_date = timezone.datetime(2026, 5, 22)
+
+ with dag_maker(dag_id=dag_id, session=session, serialized=True):
+ EmptyOperator(task_id="test_task")
+
+ session.commit()
+
+ response = client.post(
+ f"/execution/dag-runs/{dag_id}/{run_id}",
+ json={"logical_date": logical_date.isoformat()},
+ )
+
+ detail_message = response.json()["detail"]["message"]
+ detail_reason = response.json()["detail"]["reason"]
+
+ pattern = r"The run_id provided '.*' does not match regex pattern '.*'
or '.*'"
+ assert re.search(pattern, detail_message)
+ assert detail_reason == "value_error"
+ assert response.status_code == 400
+
class TestDagRunClear:
def setup_method(self):