A single echo line silently swallowed all exit codes for 28 hours
A developer running an automated Claude Code environment discovered that a faulty shell script line had been masking real exit codes for over 28 hours, making all logs falsely report success. The bug stemmed from a logging line where a command substitution inside an echo statement overwrote the $? variable before it could capture the actual exit code of the preceding process. As a result, failed jobs consistently appeared as exit 0 across 171 launchd jobs and multiple Claude Code sessions, rendering all hook-based guardrails ineffective. The incident highlights three common patterns — shell scripts, JS wrappers using child_process.exec(), and unguarded pipelines — that can silently swallow non-zero exit codes. The developer notes that such silent failures are especially dangerous in automated environments because past logs can no longer be trusted as evidence of genuine success.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in