Command timed out
Production Risk
Expected when commands hang; always handle 124 in CI/CD pipelines.
Exit code 124 is returned by the `timeout` utility when the command it is running exceeds the specified duration and is killed.
- 1The wrapped command takes longer than the timeout duration
- 2A network operation stalls indefinitely
- 3A script hangs waiting for user input in an automated context
Running a slow command with a short timeout.
timeout 2s sleep 10 echo "Exit: $?"
expected output
Exit: 124
Fix 1
Increase the timeout duration
WHEN The command normally completes but occasionally takes longer
timeout 60s your_command
Why this works
Increasing the timeout gives the command more time to complete legitimately.
Fix 2
Handle exit code 124 explicitly
WHEN In scripts that use timeout
timeout 30s curl https://example.com/api if [ $? -eq 124 ]; then echo "Request timed out after 30s" >&2 exit 1 fi
Why this works
Checking for 124 specifically lets you emit a clear error message distinct from other failures.
✕ Use very short timeouts without retry logic
Transient slowness will cause failures; implement retries with backoff for network operations.
GNU coreutils — timeout
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev