Skip to content

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

Description

@shahar1

Apache Airflow version

main (3.x), reproduced on a recent breeze start-airflow build.

What happened

When a DAG is executed via dag.test() — directly, or through the system-test harness tests_common.test_utils.system_tests.get_test_run — against a shared metadata DB, the run path writes a DagRun, a DagModel, and a SerializedDagModel under the synthetic bundle name testing. The DAG's source file is not in any configured DAG bundle, so the dag processor never parses it.

In the UI this produces an inconsistent, broken state:

  • The DAG does not appear in the Dags list (nothing parsed it).
  • Its run is visible under Dag Runs / History.
  • Opening the DAG detail page (/dags/<dag_id>) produces repeated HTTP 500s, infinite loading spinners, and intermittent "error 500" popups when navigating its links/sub-pages.

GET /ui/grid/<dag_id> returns 200, so the failure is on the detail/metadata endpoints that try to resolve the DAG's bundle / source / definition, which do not exist for a record that only lives under the synthetic testing bundle.

What you think should happen instead

The UI should handle a DAG that has run history but no live/parsed definition gracefully — e.g. render the existing runs plus a clear "definition not currently available / not parsed" state — instead of returning 500s and looping. The same situation applies to a DAG that was removed from its bundle but still has historical runs.

How to reproduce

  1. breeze start-airflow ... (UI on :28080).
  2. Run any system test against the same metadata DB, e.g.
    pytest --system providers/google/tests/system/google/cloud/.../example_*.py
    (or add if __name__ == "__main__": dag.test() to a DAG file that is not in the dags folder and run it).
  3. In the UI go to Dag Runs, find the run, and click through to the DAG → the detail page shows 500s / infinite loading.

Related

Both are the same class of problem: a DAG present in the DB but not fully backed by a parsed/bundled definition causing UI 500s.

Notes

Cleanup/workaround for an affected record: airflow dags delete <dag_id>.


Drafted-by: Claude Code (Opus 4.8) (no human review before posting)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:APIAirflow's REST/HTTP APIarea:UIRelated to UI/UX. For Frontend Developers.kind:bugThis is a clearly a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions