Skip to content

Add configurable retry behavior for API errors (500, 529, etc.) #23115

@wmatson-skyslope

Description

@wmatson-skyslope

When Claude Code encounters transient API errors (500 Internal Server Error, 529 Overloaded), there's no way for users to configure retry behavior.

Proposed solution

Add environment variables or settings to control:

  • CLAUDE_CODE_API_RETRIES - max retry attempts (default: 3)
  • CLAUDE_CODE_RETRY_DELAY_MS - initial backoff delay (default: 1000)
  • CLAUDE_CODE_RETRY_BACKOFF - exponential backoff multiplier (default: 2)

Use case

During periods of API instability, users hit repeated 500 errors that interrupt workflows. Configurable retries would allow Claude Code to recover automatically from transient failures without user intervention.

Additional context

Ironically, while researching whether this feature already existed, I encountered multiple 500 errors from the API - which would have been handled gracefully if this feature existed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssue is inactive

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions