# Airflow DAG stuck in running? depends_on_past, max_active_runs and the task with no status

> A DAG run that sits in running for hours while its first task shows no status is usually blocked by depends_on_past=True.

Source: https://rowmonitor.com/guides/airflow-dag-stuck-running · Updated 2026-11-26

## The short answer

A DAG run that sits in **running** for hours while its first task shows **no status** is usually blocked by `depends_on_past=True`. That setting lets a task run only if the same task in the previous run succeeded or was skipped ([Airflow docs, BaseOperator](https://airflow.apache.org/docs/task-sdk/stable/api.html)). If last night's run failed, tonight's task waits forever. Nothing fails, so no failure callback or failure alert fires.

With `max_active_runs=1`, it gets worse: the stuck run holds the only slot, so the scheduler creates no further runs ([max_active_runs: "beyond this number of DAG runs in a running state, the scheduler won't create new active DAG runs"](https://airflow.apache.org/docs/task-sdk/stable/api.html)). The DAG goes quiet.

Run `airflow tasks failed-deps` to confirm the cause, fix the failed run, and add `dagrun_timeout` plus an `on_failure_callback` so the next one can't hang unseen. Read the timeout section before you rely on it: a timed-out run can let the next run go green over a missing load.

Everything below was reproduced on a local, throwaway Airflow 3.4.0 (`airflow standalone`, SQLite, LocalExecutor). In Airflow 2.x this may differ: the DAG class may be imported with `from airflow import DAG`, and REST paths may be under `/api/v1` instead of `/api/v2`. Check your version's docs.

## 1. Reproduce it in two minutes

```python
# dags/orders_stuck.py  (Airflow 3.x)
import datetime as dt
from pathlib import Path

from airflow.sdk import DAG, task

FLAG = Path("/tmp/fail_once_orders_stuck")  # touch this file to make the next run fail


def notify_failure(context):
    print(f"{context['dag_run'].run_id} failed, reason={context.get('reason')}")


with DAG(
    dag_id="orders_stuck",
    schedule="*/2 * * * *",
    start_date=dt.datetime(2026, 11, 1, tzinfo=dt.timezone.utc),
    catchup=False,
    max_active_runs=1,
    on_failure_callback=notify_failure,
    default_args={"depends_on_past": True, "retries": 0},
):

    @task
    def load():
        if FLAG.exists():
            FLAG.unlink()
            raise RuntimeError("source file missing")
        return "ok"

    load()
```

Touch the flag file, unpause the DAG and wait two schedule ticks. In our run:

```shell
$ airflow dags list-runs orders_stuck
run_id                                state    start_date                        end_date
scheduled__2026-11-25T23:16:00+00:00  running  2026-11-25T23:16:01.551973+00:00
scheduled__2026-11-25T23:14:00+00:00  failed   2026-11-25T23:14:35.277013+00:00  2026-11-25T23:14:39.431334+00:00
```

The 23:14 run failed and its callback fired with `reason=task_failure`. The 23:16 run then sat in `running` with `load` in no state, and no run for 23:18, 23:20 or 23:22 was ever created.

## 2. Confirm the cause with failed-deps

[`airflow tasks failed-deps`](https://airflow.apache.org/docs/apache-airflow/stable/cli-and-env-variables-ref.html) shows why the scheduler won't queue a task instance:

```shell
airflow tasks failed-deps orders_stuck load "scheduled__2026-11-25T23:16:00+00:00"
```

```shell
Task instance dependencies not met:
Previous Dagrun State: depends_on_past is true for this task, but 1 previous task instance(s) are not in a successful state.
Task Instance State: Task is in the 'None' state.
```

If you see a different dependency (pool slots, upstream tasks, a task stuck in `queued`), this guide isn't your problem. Note the related setting `wait_for_downstream`, which forces `depends_on_past` on and also waits for the previous run's immediate downstream tasks.

To list every run that's currently running across all DAGs (Airflow 3 REST API, `~` means all DAGs):

```shell
curl -s "$AIRFLOW_URL/api/v2/dags/~/dagRuns?state=running" \
  -H "Authorization: Bearer $AIRFLOW_TOKEN"
```

Or per DAG: `airflow dags list-runs orders_stuck --state running`.

## 3. Unstick it: the clear-then-deadlock trap

The obvious fix is to fix the source, then clear the failed task so it re-runs:

```shell
airflow tasks clear orders_stuck -t '^load$' \
  -s 2026-11-25T23:14:00+00:00 -e 2026-11-25T23:14:00+00:00 -f -y
```

With `max_active_runs=1` this is not enough. In our test the cleared 23:14 run went to **queued** and stayed there, because the blocked 23:16 run still held the only active slot. Clearing the 23:16 task as well changed nothing: it had no state to clear, and its run stayed `running`.

What worked was putting the blocked run back in the queue too, so both runs waited and the scheduler took them oldest first:

```shell
curl -s -X PATCH \
  "$AIRFLOW_URL/api/v2/dags/orders_stuck/dagRuns/scheduled__2026-11-25T23:16:00+00:00" \
  -H "Authorization: Bearer $AIRFLOW_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"state": "queued"}'
```

Within a minute, 23:14, then 23:16, then the next scheduled runs all succeeded. Two things to know:

- The runs for 23:18, 23:20 and 23:22 never existed. With `catchup=False` (the Airflow 3 default, [Dag Runs docs](https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dag-run.html)), the scheduler picks up from the latest interval and doesn't create the ones it skipped. If each run loads its own interval, backfill those intervals.
- If you'd rather not requeue, raise `max_active_runs` while you recover, then set it back.

## 4. Add a timeout, and know what it does

`dagrun_timeout` fails a run that runs too long. In the scheduler, a timed-out run is set to `failed`, its unfinished task instances (including ones with no state) are marked **skipped**, and the DAG's `on_failure_callback` gets `reason="timed_out"` ([DAG parameters](https://airflow.apache.org/docs/task-sdk/stable/api.html), [scheduler source](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/jobs/scheduler_job_runner.py)).

```python
with DAG(
    dag_id="orders_timeout",
    schedule="*/2 * * * *",
    start_date=dt.datetime(2026, 11, 1, tzinfo=dt.timezone.utc),
    catchup=False,
    max_active_runs=1,
    dagrun_timeout=dt.timedelta(minutes=3),
    on_failure_callback=notify_failure,
    default_args={"depends_on_past": True, "retries": 0},
):
    ...
```

Our callback log:

```shell
scheduled__2026-11-25T23:14:00+00:00 reason=task_failure
scheduled__2026-11-25T23:16:00+00:00 reason=timed_out
```

Here's the catch. `depends_on_past` passes when the previous task instance succeeded **or was skipped**. The timeout skipped the blocked `load`, so the 23:18 run's `load` was allowed to run, and it succeeded:

```shell
run_id                                state
scheduled__2026-11-25T23:18:00+00:00  success
scheduled__2026-11-25T23:16:00+00:00  failed   (timed out, load skipped)
scheduled__2026-11-25T23:14:00+00:00  failed   (load failed, never re-run)
```

The DAG is green again, and the 23:14 load still never happened. So:

- Treat the timeout alert as "go fix and backfill", not as recovery.
- Set `dagrun_timeout` comfortably above your slowest normal run, or good runs get failed too.
- Check the output table, not only the DAG state: a freshness or row-count check catches the missing interval after the DAG has gone green.

## Where Row Monitor fits

Row Monitor's Airflow plugin (`pip install rowmonitor-airflow`, Airflow 2.6+ and 3.x) pushes DAG and task run events and a heartbeat of unpaused DAG schedules. It's included in every plan: 5 DAGs on Free, 50 on Pro (US$39/month), 100 on Team (US$99/month). For the cases above:

- **The first failure** (23:14): a failed-run alert in Slack or email, with the failed task names.
- **The run stuck in running**: an "unusually slow" alert once the run, still in progress, has taken much longer than its recent baseline. This needs at least five successful runs of history.
- **The runs the scheduler never created**: an expected run that never arrives is flagged from the schedule heartbeat, within about 15 minutes. The plugin can't see a run the scheduler never created, so this comes from the schedule, not from a run event.
- **The green run over a missing load**: map the DAG to the table it produces, and Row Monitor's daily table checks flag a row-count drop or a stale table, with the linked DAG's last run shown as context.

[rowmonitor-runcheck](https://github.com/kharipara/rowmonitor-runcheck) only checks the latest run. It does not flag a run that is still running. [Commands](https://rowmonitor.com/airflow#runcheck).

It reads run metadata only (no connections, variables, XComs or logs) and never writes to your warehouse. [See how the Airflow checks work](https://rowmonitor.com/airflow) or [start free](https://rowmonitor.com/signup).

## Hear about the next stuck run

Row Monitor's Airflow plugin (`pip install rowmonitor-airflow`, Airflow 2.6+ and 3.x) is included in every plan: 5 DAGs on Free, 50 on Pro (US$39/month), and 100 on Team (US$99/month). A failed run alerts in Slack or email with the failed task names.

[Start free](https://rowmonitor.com/signup)

## FAQ

### Why does my Airflow task show no status while the DAG run is running?

The scheduler hasn't queued it because a dependency isn't met. With `depends_on_past=True`, the usual one is that the same task failed in the previous run. Run `airflow tasks failed-deps <dag_id> <task_id> <run_id>` to see the exact reason.

### Does depends_on_past block the very first run?

No. The task instance for the start_date is allowed to run, and `ignore_first_depends_on_past` lets a newly added task's first instance run too. In Airflow 2.x this may differ: the docs say the default is `True` since Airflow 2.3. Check your version's docs.

### Will a stuck run trigger on_failure_callback?

Not on its own. Nothing has failed. Set `dagrun_timeout`: when it expires the run fails and the callback receives `reason="timed_out"`.

### Why didn't clearing the failed task fix it?

With `max_active_runs=1`, the blocked run still holds the only active slot, so the cleared run waits in `queued`. Requeue the blocked run too, or raise `max_active_runs` while you recover.

### Is the DAG fine once the next run succeeds?

Not necessarily. A timed-out run's tasks are marked skipped, which satisfies `depends_on_past`, so later runs can succeed while the original failed interval is never re-run. Backfill it and check the output table.
