Course outline

Apache Airflow / Basic: definitions, intervals and safe task execution / Lesson 7

Task states and incident evidence

Interpret task-instance states and collect the evidence needed to diagnose a failed DAG run.

About 3 min readContent reviewed
On this page

Lesson goals

  • Distinguish a task failure from an upstream-dependent state.
  • Trace one attempt and its destination effects before retrying.

Identify the exact task instance

A DAG definition, a DAG run, a task instance and an attempt describe different parts of an orchestration history. Record the DAG identifier, run identity, task identifier, attempt, data interval and state before investigating. A task can have several attempts, so a log from an older attempt may explain a different failure. Use sanitized evidence and avoid exposing connection secrets.

Inspect the failed attempt

This synthetic record says that the extract task’s first attempt failed in one daily run. It is an illustrative incident record, not an Airflow API response or an executed DAG. Inspect the matching attempt log, execution environment and external operation evidence to determine what failed. A failed task state alone does not identify the cause or prove that no destination write occurred.

json A failed synthetic task attempt
{"dag_run":"daily-2026-11-05","task":"extract","attempt":1,"state":"failed"}

The record identifies a run, task and attempt without accessing Airflow.

Trace an upstream-dependent state

The second fixture shows publish marked upstream_failed in the same run. Investigate the dependency and trigger rule to understand why it did not execute; do not diagnose it as though its application command necessarily failed. The exact state and behavior depend on the configured DAG and deployed version. Compare the graph and attempt evidence before choosing which task to repair.

json A downstream task affected by failure
{"dag_run":"daily-2026-11-05","task":"publish","state":"upstream_failed"}

The state points the investigation toward its upstream dependency under this example.

Check external effects before retry

Place the last confirmed source read, destination acknowledgment and task failure on a timeline. If a write completed before the worker lost its acknowledgment, a retry may repeat it. Identify the business interval and destination idempotency contract, then reconcile uncertain effects with the data owner. A later green task is useful execution evidence but does not by itself prove the output is correct.

Verify a bounded repair

In a disposable DAG, create a controlled extract failure and observe the downstream task state. Correct the synthetic cause and run the intended interval again, checking both task states and the destination’s business keys. Include a failure after an illustrative write if the destination contract supports safe testing. Record what was tested and avoid triggering production backfills just to clear a visual failure.

Common errors and fixes

The downstream task is blamed for an upstream failure.

Why it happens
Its state was read without the dependency graph.
How to fix it
Trace the failed upstream attempt and trigger rule.
Prevent it next time
Record task and run identity with incident evidence.

An old attempt log is used for the current failure.

Why it happens
The attempt number was omitted.
How to fix it
Select the log for the affected task instance and attempt.
Prevent it next time
Include attempt identity in the incident timeline.

A retry duplicates output.

Why it happens
The original external write was not reconciled.
How to fix it
Inspect destination state and use the approved repeat-safe contract.
Prevent it next time
Test the write-to-failure interval in isolation.

2 practice exercises

1. Extract failed and publish is upstream_failed. Where should investigation begin?

Show worked solution

Inspect extract’s matching attempt log and the dependency and trigger rule leading to publish. The downstream state indicates a dependency issue in this fixture; it does not prove that publish ran and failed.

2. A task failed after sending a request but before recording its response. Is a retry automatically safe?

Show worked solution

No. The destination may have accepted the request. Inspect its durable state and idempotency contract, then follow the owner’s bounded recovery process before repeating the operation.

Key takeaways

  • Identify the run, task and attempt before interpreting a state.
  • Reconcile external effects independently of the final task state.

Official references