Claude Code staff explains hook exit codes: Only exit code 2 triggers a retry in Claude.
Automated summary · Based on collected summaries; not individually verified
Prepared by HotAI
What happened
Lydia Hallie explains that exit code 1 in Claude Code can also indicate an error within the hook itself (such as missing dependencies or script bugs). To trigger a retry, use exit code 2 and write output to stderr, for example: "[your command] >&2 || { echo failed; exit 2; }"。
Background
What is Claude Code? How Claude models participate in project development
Claude Code is Anthropic’s coding agent product using Claude models for development tasks in codebases. It organizes file reading, editing and tool feedback into ongoing work rather than only chat advice. For a failed test, it can inspect implementation and run relevant commands. Actual execution depends on environment, authorization and task state.
What Is Claude? The Model Family and Its Coding Tools
Claude is a family of generative models developed by Anthropic for tasks such as text analysis and coding, with image understanding available in vision-capable versions. “Using Claude” may mean the chat app, a model API call or Claude Code. The model generates responses and tool requests; the application supplies files and an execution environment. These layers under the same brand determine how much of a task can actually be completed.
Reading notes
The event summary comes from collected excerpts. Background passages quote existing HotAI articles to explain terms and do not establish new facts about this event. Check the original sources for product results, conditions and subsequent updates.
Original source
Sources and collection timeline
| Source | Report title | Original publication time | Collected by HotAI |
|---|---|---|---|
| x.com | Claude Code staff explains hook exit codes: Only exit code 2 triggers a retry in Claude. | 2026-11-14 02:43 | 2026-11-14 02:57 |