エラーは Anthropic のエラーエンベロープを使います。
  • error.type が HTTP ステータスを決めます。一般的な分岐はこれで行います。
  • error.code は安定した機械可読の理由です。個別の理由で分岐するときに使います。下の一覧は今後増えるため、未知のコードは同じ type の他のエラーと同様に扱ってください。
  • error.message は人向けです。解析しないでください。
  • サポートへ連絡するときは request_id を添えてください。
  • 409 に x-should-retry: true が付くのは、同じリクエストの再試行が成功し得る場合(例:Idempotency-Key がまだ処理中)だけです。
retry の行は、同じリクエストを変更せずに後で再試行すると成功し得ることを示します。指数バックオフで再試行してください。印のない行は、リクエストまたは状態を変えるまで再び失敗します。

invalid_request_error (HTTP 400)

リクエストの形式が不正、または受け付けられません。 対処(行に別の記載がない限り): Correct the request as the message describes and send it again; the same request will keep failing.

authentication_error (HTTP 401)

認証情報がない、誤っている、または期限切れです。 対処(行に別の記載がない限り): Send a valid credential (API key, access token or console session) and retry.

permission_error (HTTP 403)

認証情報は有効ですが、この操作は許可されていません。 対処(行に別の記載がない限り): Use a credential with the required role or access; retrying with the same credential will not help.

not_found_error (HTTP 404)

対象リソースが存在しません(または呼び出し元から見えません)。 対処(行に別の記載がない限り): Check the ID and the organization or workspace it belongs to; do not retry the same request.

conflict_error (HTTP 409)

リクエストがリソースの現在の状態と競合しています。 対処(行に別の記載がない限り): Re-read the resource, resolve the conflicting state, then send the request again.

request_too_large (HTTP 413)

リクエストがサイズ上限を超えています。 対処(行に別の記載がない限り): Delete older machine backups or raise the limit, then retry.

rate_limit_error (HTTP 429)

リクエストまたは試行が多すぎます。 対処(行に別の記載がない限り): Wait for the Retry-After interval (or back off exponentially) and retry.

api_error (HTTP 500)

プラットフォーム側のエラーです。 対処(行に別の記載がない限り): Retry with exponential backoff; the dependency is temporarily unavailable.

timeout_error (HTTP 504)

上流またはマシンが時間内に応答しませんでした。 対処(行に別の記載がない限り): Retry with exponential backoff; the operation may have continued, so read the resource first.

overloaded_error (HTTP 529)

プラットフォームまたは依存先が一時的に過負荷です。 対処(行に別の記載がない限り): Retry with exponential backoff.