airflow.exceptions.AirflowSensorTimeout: sensor timed out
Fixes the AirflowSensorTimeout error: why sensors time out, how to set timeout and poke intervals sanely, and when to replace a sensor with a deferrable operator. Use when a sensor task fails with this exact exception. Not for tasks that time out doing their own work.
TL;DR
The sensor waited longer than its timeout for the condition to become true, so Airflow failed it. First check whether the thing being sensed actually arrived late or never arrived. Then set timeout above the realistic wait and poke_interval high enough to avoid hammering the external system; for long waits, switch to a deferrable sensor so you stop occupying a worker slot.
airflow.exceptions.AirflowSensorTimeout: sensor timed outUse this when
- A sensor task fails with AirflowSensorTimeout in the logs.
- Upstream data or files arrive later than the sensor timeout allows.
- Sensors occupy worker slots for hours while waiting.
Not for this skill when
- A regular task times out mid-execution. That is execution_timeout on the task.
- The sensor errors immediately instead of waiting. That is a poke-function bug.
Steps
- Read the sensor task log and confirm the timeout value and how long it actually waited. Note the condition never became true within the window. Verify: you know the wait was real, not a misconfig
- Check whether the sensed thing exists now: the file, the partition, the API record. Note whether it arrived late or never. Verify: you know if the timeout was correct behavior
- Set timeout to cover the realistic worst case and raise poke_interval so pokes happen minutes apart, not seconds. Note the sensor survives a normal late arrival. Verify: late-but-normal arrivals pass
- For waits longer than an hour, convert to the deferrable variant of the sensor so the worker slot is freed between pokes. Note worker occupancy drops to near zero while waiting. Verify: slots are no longer burned on waiting
- Add an SLA or alert on the sensor so a genuinely missing upstream pages someone instead of timing out quietly. Note the next real miss notifies the team. Verify: misses become alerts, not silent failures
Variant phrasings
airflow sensor timed out
The shortened phrasing.
AirflowSensorTimeout poke interval
The tuning-shaped search.
Compatibility: Airflow 2.x. Deferrable operators need the triggerer running; poke_interval and timeout semantics are stable across 2.x.
Why it happens
Sensors are polling loops with a deadline. The default timeout is often far shorter than real-world upstream delays, and the default poke interval hammers the sensed system every minute. When the deadline hits, Airflow raises AirflowSensorTimeout and fails the task. The fix is almost never to just raise the timeout blindly; it is to match the timeout to reality, space out the pokes, and stop holding a worker slot hostage with deferrable mode.
Edge cases / pitfalls
- mode='reschedule' frees the slot but re-queues the task each poke; on a busy scheduler the re-queue delay can itself look like a stall.
- Sensors with timeout=None wait forever and silently block downstream tasks. Always set an explicit timeout.
- A sensor that times out because the poke function throws is misdiagnosed easily. Check the log for exceptions before the timeout line.
- Daylight-saving and timezone-naive schedules shift expected arrival times. Verify the sensor watches the right interval.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_aDQGd-QASvseiUHHuA74mw