首页› 资讯库› Claude Code 员工讲解 hook 退出码用法:exit 2 才能让 Claude 重试 微资讯 · 来源报道 Claude Code 员工讲解 hook 退出码用法:exit 2 才能让 Claude 重试 AIHOT 最近七天 2026-11-13 更新 2026-11-14 返回首页 阅读原文 Lydia Hallie 说明 Claude Code 中 exit 1 也可能表示 hook 本身出错(如缺依赖或脚本 bug)。想让 Claude 重试应退出码用 2,并把输出写到 stderr,例如 "[your command] >&2 || { echo failed; exit 2; }"。 回首页继续看 →