Skip to content

Return 404 instead of 500 for Dags whose serialized definition cannot be loaded#69099

Open
itej13 wants to merge 1 commit into
apache:mainfrom
itej13:fix-ghost-dag-detail-500
Open

Return 404 instead of 500 for Dags whose serialized definition cannot be loaded#69099
itej13 wants to merge 1 commit into
apache:mainfrom
itej13:fix-ghost-dag-detail-500

Conversation

@itej13

@itej13 itej13 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

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?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

… be loaded

A Dag can have run history and a serialized row in the metadata DB while its
definition can no longer be reconstructed -- for example 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 DagBag only handled the missing-row case, so a
deserialization error escaped uncaught and surfaced as repeated HTTP 500s on
the Dag detail page. Treat an undeserializable definition the same as a missing
one so read-only API callers return a clean 404.
@itej13 itej13 requested review from XD-DENG and ashb as code owners June 28, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: DAG detail page 500s / infinite load for DAGs with run history but no parsed definition (e.g. created by dag.test()/system tests)

1 participant