Airflow Troubleshooting
Every Airflow user meets problems: a DAG that refuses to appear, a task that hangs, a run that never starts. Most issues follow a few common patterns. A calm, step-by-step check finds the cause quickly.
The Doctor Visit Picture
A doctor asks about symptoms, runs simple tests, and then picks a treatment. Troubleshooting works the same way. Observe the symptom, check the likely causes, and apply the fix.
Symptom ──► Check logs / UI / CLI ──► Find cause ──► Apply fix ──► Verify
Where to Look First
| Source | What It Tells You |
|---|---|
| Task logs in the UI | The exact error from your code |
| Scheduler logs | Why tasks do not start |
airflow dags list-import-errors | Files that failed to load |
| Grid view colors | The state of every task |
| Admin pages | Pools, connections, and variables |
Problem 1: The DAG Does Not Appear
- Run
airflow dags list-import-errorsand read the message. A syntax error or a missing library is the usual cause. - Confirm the file sits in the dags folder shown by
airflow config get-value core dags_folder. - Check that the file contains the words
dagandairflow. Airflow skips files without them by default. - Wait a minute, since the scheduler scans for new files on a timer.
Problem 2: The DAG Never Runs
- The pause toggle sits in the off position. Turn it on.
- The
start_datelies in the future. - The scheduler process is down. Start it and read its log.
- The DAG reached
max_active_runs, and an older run blocks new ones.
Problem 3: Surprise Old Runs Appear
A DAG with a past start_date and catchup=True creates one run for every missed interval. Set catchup=False to run only the latest interval.
start_date = Jan 1, today = Jan 30, schedule = @daily catchup=True → 29 runs start at once catchup=False → 1 run starts
Problem 4: A Task Stays Queued
- All worker slots are busy. Add workers or raise
worker_concurrency. - The pool has no free slots. Check Admin, then Pools.
- A concurrency limit blocks it. Compare
parallelismandmax_active_tasks_per_dag.
Problem 5: A Task Fails
- Click the red square and open Logs.
- Read from the bottom up, since the final lines hold the error message.
- Reproduce the failure with
airflow tasks test dag_id task_id date. - Fix the code or the connection, then clear the task to rerun it.
Problem 6: Connection Errors
| Message | Likely Cause |
|---|---|
| Connection refused | Wrong host or port, or the service is down |
| Authentication failed | Wrong user or password in the connection |
| Connection not found | Typo in conn_id, or the connection was never created |
| Timeout | Firewall or network block |
Containers often cause host problems. The name localhost inside a container points to the container itself, not to your computer.
Problem 7: Zombie or Missing Heartbeat Tasks
Airflow marks a task as failed when its worker stops sending heartbeats. A killed process or an out-of-memory error often causes this. Check worker memory use and container limits, and split heavy tasks into smaller pieces.
Problem 8: Wrong Dates in Output
The logical_date marks the start of the data interval, not the moment the run begins. A daily run for 15 January starts after 15 January ends. Confusion about this rule creates many date bugs. Check the Rendered Template page to see the actual values.
A Simple Debug Routine
1. Read the error in the task log 2. Run the task alone with airflow tasks test 3. Check connections, variables, and file paths 4. Check resources: memory, slots, pools 5. Fix one thing at a time 6. Clear the task and confirm the fix
Prevent Repeat Problems
- Add retries and failure alerts to every DAG.
- Run import tests before each deployment.
- Document known fixes in the DAG's
doc_mdfield.
Key Takeaways
- Logs and import-error checks solve most problems.
- Paused DAGs, future start dates, and a stopped scheduler explain most missing runs.
- Queued tasks point to capacity limits.
- Changing one setting at a time keeps debugging clear.
