itej13 opened a new pull request, #69099: URL: https://github.com/apache/airflow/pull/69099
A Dag can have run history and a serialized row in the metadata DB while its definition can no longer be reconstructed — e.g. when it was written under a synthetic bundle by `dag.test()` / system tests against a shared DB, or when its serialized blob references an operator class that is not importable in the API server. The serving `DBDagBag` only handled the missing-row case (`None` → 404). A deserialization error from `from_dict()` escaped uncaught through `DBDagBag._read_dag`, surfacing as repeated **HTTP 500s** and infinite loading on the Dag detail page (while the grid endpoint stayed at 200). This change catches the failure at that single read chokepoint and treats an undeserializable definition the same as a missing one, so every read-only Dag detail/version/run API endpoint returns a clean 404. The guard is scoped to the serving `DBDagBag`, not the `SerializedDagModel.dag` property, so the scheduler/writer paths still surface deserialization errors loudly. closes: #69035 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 4.8) Generated-by: Claude Code (Opus 4.8) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
