Claude Code Stop hook trick: use exit code 2 to make Claude retry automatically when checks fail
Original title:You can use a Stop hook to have Claude try again when a check fails, but make sure it exits with code 2!
AI summary
Lydia Hallie shares a Claude Code tip: use a Stop hook to make Claude retry automatically after a failed check, with the key being to have the hook exit with code 2. Exit 2 returns the hook's stderr to Claude and triggers a retry, while exit 1 is non-blocking, so Claude ends directly even if the check fails.
Key Takeaways
- Lydia Hallie shares a Claude Code tip: use a Stop hook to make Claude retry automatically after a…
- with the key being to have the hook exit with code 2.
- Exit 2 returns the hook's stderr to Claude and triggers a retry,while exit 1 is non-blocking,so…
Quick Facts
- Published
- Category
- Tutorials & Tips
- AI score
- 69
原文讲清了 Claude Code Stop hook 中 exit 1 与 exit 2 的行为差异,可用于让检查失败时自动重试。
Related entities
Source & copyright
This article is based on curated titles and AI summaries from the AIHOT public API, with attribution and links back. Original copyright remains with the original publishers and authors; this site does not mirror full texts.
How to Cite
When citing this article, keep the title, date, and permalink, and credit Orange News as the source.
Orange News: Claude Code Stop hook trick: use exit code 2 to make Claude retry automatically when checks fail. November 14, 2026. https://new.nat6.net/en/news/p0jsxs2bnv6tmnmn1soi56759/