CLAUDE_CODE_DISABLE_REFUSAL_RETRY
Updated by Alex Sorokoletov
CLAUDE_CODE_DISABLE_REFUSAL_RETRY is a Claude Code environment variable: When set, disables the automatic retry of a response that stopped with a refusal. Added between v2.1.269 and v2.1.283 and still present in v2.1.332. It is not in the official reference.
| Status | Present in v2.1.332 |
|---|---|
| Added | Added between v2.1.269 and v2.1.283 |
| Category | Network and proxy |
| Official docs | Not listed |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_CODE_DISABLE_REFUSAL_RETRY=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_DISABLE_REFUSAL_RETRY": "<value>"
}
}Related variables
CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUTCLAUDE_CODE_DISABLE_MEMORY_STREAM_LIST: Turns off the incremental metadata-streaming path inside multi-store memory sync.CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTIONCLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK: Disables the fallback path that retries failed streaming requests as non-streaming calls.CLAUDE_CODE_DISABLE_PROXY_SCHEME_REPAIRCLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS: Sets the base delay, in milliseconds, for the backoff when a request comes back overloaded (HTTP 529).CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS: Raises the ceiling on the backoff delay when retrying a request that returned a 529 overloaded response.CLAUDE_CODE_OVERLOADED_RETRY_MAX_WAIT_MS: Maximum wait in milliseconds before retrying after an overloaded response; used only on the main request when neither the max-retries nor retry-watchdog variables are set and a server-side setting is on.
Frequently asked questions
What does CLAUDE_CODE_DISABLE_REFUSAL_RETRY do?
When set, disables the automatic retry of a response that stopped with a refusal.
Which Claude Code version has CLAUDE_CODE_DISABLE_REFUSAL_RETRY?
Added between v2.1.269 and v2.1.283 and still present in v2.1.332.
How do I set CLAUDE_CODE_DISABLE_REFUSAL_RETRY?
Export it before starting Claude Code (export CLAUDE_CODE_DISABLE_REFUSAL_RETRY=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.
All variables, searchable: Claude Code environment variables.