The failed state marks a task that has crashed or stopped working as expected. It is one of five task lifecycle states—Pending, Scheduled, Running, Completed, and Failed—and represents unsuccessful execution rather than normal completion or user-initiated stopping. section 2.1 section 4.6.3
A worker and manager use the state to decide what actions are valid. Scheduling or starting a task can produce Failed when the operation does not succeed: Pending can become Failed during scheduling, while Scheduled or Running can become Failed during startup or execution. Failed has no outgoing transitions in the defined transition map, so it is terminal. section 2.7 section 4.6.3
The minimal implementation models failure explicitly:
- Represent Failed as a value in the Go State type alongside Pending, Scheduled, Running, and Completed. section 2.1
- Permit transitions from Pending, Scheduled, or Running to Failed when the corresponding scheduling, startup, or execution event fails. section 4.6.3 section 4.6.3
- Reject transitions out of Failed by assigning it an empty destination list. section 4.6.3
Table 4.1 State transition table showing the valid transitions from one state to another (view table figure)
Use the transition table to inspect which events can move a task into Failed and which lifecycle states have no recovery path. section 4.6.3
