You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "1fanwang (via GitHub)" <gi...@apache.org> on 2026/09/11 07:07:22 UTC
[PR] Return 404 when DagRun is missing in patch_task_state_store [airflow]
1fanwang opened a new pull request, #72926:
URL: https://github.com/apache/airflow/pull/72926
When a task instance had no associated DagRun in the database, updating an existing task state key caused the metastore backend to raise an unhandled ValueError. This escaped to the application handler and returned an HTTP 500 error instead of a missing resource response.
This change catches ValueError in patch_task_state_store and returns a 404 Not Found error, matching the error handling in the sibling set endpoint.
# Testing Done
Reproduction before fix:
```bash
uv run --project airflow-core pytest airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_state_store.py -k test_patch_nonexistent_dag_run_returns_404
```
Pre-fix output:
```text
FAILED test_task_state_store.py test_patch_nonexistent_dag_run_returns_404 - ValueError: No DagRun found for dag_id='dag' run_id='nonexistent_run'
```
Verification after fix:
```bash
uv run --project airflow-core pytest airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_state_store.py -k "test_patch_nonexistent_dag_run or test_set_nonexistent_dag_run"
```
Post-fix output:
```text
================= 2 passed, 95 deselected, 2 warnings in 4.42s =================
```
<details>
<summary>Raw logs</summary>
```text
test_task_state_store.py test_set_nonexistent_dag_run_returns_404 PASSED [ 50%]
test_task_state_store.py test_patch_nonexistent_dag_run_returns_404 PASSED [100%]
```
</details>
--
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
Re: [PR] Return 404 for task-state writes after a Dag run is deleted [airflow]
Posted by "1fanwang (via GitHub)" <gi...@apache.org>.
1fanwang commented on PR #72926:
URL: https://github.com/apache/airflow/pull/72926#issuecomment-5839715599
Closing — folded the extra write-path (PATCH) 404 handling into #72907 in https://github.com/apache/airflow/commit/a21cfdf303ea44e37e9f4c14f8bad07db2cd2a09, since both PRs touch the same DagRunNotFound path and #72907 covers this scope now.
--
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
Re: [PR] Return 404 for task-state writes after a Dag run is deleted [airflow]
Posted by "1fanwang (via GitHub)" <gi...@apache.org>.
1fanwang closed pull request #72926: Return 404 for task-state writes after a Dag run is deleted
URL: https://github.com/apache/airflow/pull/72926
--
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