Exit 1 can mean the hook itself errored — use exit 2 for Claude Code retries
lydiahallie · x · 2026-11-14
Follow-up to Lydia Hallie's Stop hook tip: exit 1 can also mean the hook itself errored (e.g. a missing dependency or a bug in the hook script), so use exit 2 when you want Claude to retry, and send output to stderr so it can see what went wrong.
Concrete pattern provided: [your command] >&2 || { echo failed; exit 2; } — redirect output to stderr and exit 2 on failure to trigger the retry loop.
Related event: Claude Code Stop hook tip: use exit 2 to trigger auto-retry(2 posts)→
More from coding & agent
- Dev's fix for chaotic agent work: a feed-shaped todo list with action buttons — _rchaves_ · 2026-11-14
- Dev replaces his smartphone with 8 Raspberry Pis controlled by OpenAI's Dot — OpenAIDevs · 2026-11-14
- Garry Tan open-sources idea-miner skill that turns your last 48 hours into a ranked build list — garrytan · 2026-11-14
- LLMLean is back: LLM-powered proof suggestions for Lean, local or cloud — wellecks · 2026-11-14
- Grady Booch: Dissolving institutional knowledge and adding AI slop to codebases never ends well — Grady_Booch · 2026-11-14
- Map-driven autoresearch: let Claude pick ideas, run experiments, and reallocate resources — danshipper · 2026-11-14