[FEATURE] Option to override ~/.claude/settings.json
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The error message below is incorrect. Per company policy, I have set CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096 in my ~/.claude/settings.json, which means restarting Claude with the environment variable set and exported accomplishes nothing.
(I would apologize for the atrocious formatting with lots of trailing spaces etc; but then you are responsible for that yourselves, so maybe I won't.)
⏺ Read 2 files (ctrl+o to expand)
⎿ API Error: Claude's response exceeded the 4096 output token maximum. To
configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS
environment variable.
⎿ API Error: Claude's response exceeded the 4096 output token maximum. To
configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS
environment variable.
⎿ API Error: Claude's response exceeded the 4096 output token maximum. To
configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS
environment variable.
⎿ API Error: Claude's response exceeded the 4096 output token maximum. To
configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS
environment variable.
Proposed Solution
Provide a mechanism for overriding a settings.json setting temporarily from the command line, so that (a) the error message can be changed to provide a workaround which actually works, and (b) we don't have to manually change a shared file to get the desired behavior in one specific session.
Off the top of my head, something like claude --setting CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096
Alternative Solutions
You could temporarily change settings.json but then does that affect currently running Claude instances? How do you remember to change it back before you start additional sessions? If you have some agentic process (such as Claude itself) starting up new Claude instances in other terminal windows, how do you prevent it from starting new sessions with the temporary setting when you didn't want it to?
Perhaps explicit environment variables _should_ override what's in settings.json?
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
For this particular setting, whenever you get the error message and want to restart Claude with a different setting.
More generally, there are obviously many scenarios when you might want to override your static defaults, such as when temporarily reverting to an earlier version of the model than what's in your settings.json
Additional Context
_No response_
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗