settings.json

StopFailure

API エラー(レート制限、認証失敗、サーバーエラーなど)によりターンが終了した際に実行されるフック。

使い方・用途

  • レート制限や認証エラーなどの失敗を検知して、自動的に管理者へ通知を送ったりトラブルシューティング用のログを記録したりします。
英語原文(公式ドキュメントより)

Hooks that run when a turn ends due to an API error (e.g., rate_limit, authentication_failed, billing_error, invalid_request, server_error, max_output_tokens, unknown). Matcher can scope to specific error types. Hook output and exit code are ignored. See https://code.claude.com/docs/en/hooks

関連する変更履歴

v2.1.78 (1件)

Added
APIエラー(レート制限、認証失敗など)によりターンが終了した際に発火する StopFailure フックイベントを追加
英語原文を表示
Added StopFailure hook event that fires when the turn ends due to an API error (rate limit, auth failure, etc.)

変更前

APIエラーで処理が中断された場合、それをフックして自動的に通知を送ったりログを記録したりする仕組みがありませんでした。

変更後

StopFailure イベントにより、レート制限や認証エラーなどの失敗を検知して特定のスクリプトを実行できるようになりました。

ユーザーへの恩恵

エラー発生時の後処理を自動化し、モニタリングやトラブルシューティングの効率を向上させることができます。