[BUG] /config shows a toggled setting as changed, with no error, when settings.json cannot be written
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When the user settings file cannot be written, toggling Auto-compact in /config shows the new value and prints a confirmation (Disabled auto-compact), but nothing is saved and no error appears.
The file on disk is unchanged, and a new session shows the original value. From reading the bundle, other /config toggles appear to use the same setter, but Auto-compact is the only one I exercised.
What Should Happen?
If the settings write fails, /config should show an error naming the file and the reason, and the panel should not keep displaying a value that was never saved.
Error Messages/Logs
Nothing is shown in the UI. After closing /config, the transcript shows:
⎿ Disabled auto-compact
Steps to Reproduce
Assumes an existing, writable ~/.claude/settings.json, with Auto-compact at its default true.
- Back up the settings file to a name that does not already exist, and keep that name for step 7:
BAK=$(mktemp ~/settings-backup.XXXXXX)
cp ~/.claude/settings.json "$BAK"
shasum -a 256 ~/.claude/settings.json
- Make the file immutable:
chflags uchg ~/.claude/settings.json(macOS;chmod 444untested, see Additional Information) - Start
claude, run/config, use the arrow keys to highlight Auto-compact, and press Space. The panel showsfalse. - Press Esc. The transcript shows
Disabled auto-compact. No error is displayed. - Run
shasum -a 256 ~/.claude/settings.jsonagain. The hash is unchanged. - Exit and start a new
claudesession, then open/config. Auto-compact istrueagain. - Clean up:
chflags nouchg ~/.claude/settings.json && cp "$BAK" ~/.claude/settings.json(if the file was already immutable before you started, re-applychflags uchg ~/.claude/settings.json)
Control, run separately: with a temporary CLAUDE_CONFIG_DIR whose settings.json was {} and writable, the same toggle saved "autoCompactEnabled": false the moment Space was pressed, and a fresh session showed Auto-compact false. Only the failed write is silent.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.270 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Terminal: tmux on macOS.
From reading the 2.1.270 bundle (not verified against source): the /config handler for these toggles calls a setter that starts the settings write without awaiting it or checking its { error } result, then updates the panel's in-memory state. /effort does surface a failed write (see #67208), and /config does not appear to.
The writer's error text says Failed to read raw settings for what is a write failure, as already noted in #67208 and seen in #78162.
I used chflags uchg rather than chmod 444, since the save appears to write a temp file and rename it over the target (see #78162). chmod 444 is untested.
Related, but with a different trigger: #78162 (symlink chain), #67208 (relative symlink; reproduced with /effort, which shows the error; it predicted /config was affected but did not test it), #55485 (read-only settings from home-manager).