[BUG] Selecting model with /model deletes content of settings.json

Status Closed — not planned
Maintainer reply ✓ Yes — dicksontsai
Activity 11 comments · opened Jul 7, 2025 · closed Jan 5, 2026
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [x] Other: Claude Max
  • Claude CLI version: 1.0.43 (Claude Code)
  • Operating System: macos 15.5
  • Terminal: zish shell - iTerm, Ghostty, vscode terminal - same issue

Bug Description

When selecting the model with /model, everything in ~/.claude/settings.json gets replaced with model key value in case of opus or sonnet or just empty {} in default case.

So settings.json is left with just {} or

{
  "model": "<sonnet or opus>"
}

Steps to Reproduce

  1. Start claude code CLI with default claude (or any flag really)
  2. Select model with /model
  3. Check ~/.claude/settings.json

Expected Behavior

Only model should change in settings when selecting model with /model

Actual Behavior

Any other settings that are not model selection gets removed and only model is left

Additional Context

Launching with --model <modelname> does not affect the settings.json file.

View original on GitHub ↗

11 Comments

dgtise25 · 1 year ago

downgrade to npm install -g @anthropic-ai/claude-code@1.0.41

dicksontsai collaborator · 1 year ago

Do you happen to have the ~/.claude/settings.json file before your usage of /model? The main issue is likely that whatever was in ~/.claude/settings.json before was invalid JSON, so Claude Code thinks that it should just replace the entire file.

dgtise25 · 1 year ago

No mine got deleted when it auto upgraded to 1.0.43. This latest version is full of bugs, I'd stay away from it. I am NOT a fan of their frequent updates, their version releases are not well bug checked, so I stick with an old version I know that works.

dre-on · 1 year ago
No mine got deleted when it auto upgraded to 1.0.43.

Same. Previously it didn't happen.

Do you happen to have the ~/.claude/settings.json file before your usage of /model?

@dicksontsai The JSON is valid as hooks and all worked fine. This started after the upate, with no changes done to settings.json at all, when running with no changes to the models the settings file is parsed correctly, hooks work as intended, etc.

jacquesjg · 1 year ago

Happens to me as well.

dre-on · 1 year ago

seems to be fixed as of 1.0.51

samburger · 1 year ago

still occurring to me as of 1.0.53, both standalone binary and npm install. @dre-on if you wouldn't mind re-opening?

dicksontsai collaborator · 1 year ago

Note: The /doctor command now warns you if your settings file is valid (and you can also see that warning in /status). Currently, if your settings file is invalid, using /model will overwrite your invalid settings. We are working on changing the behavior so that if the settings are invalid, /model will instead warn you to check your settings file first.

github-actions[bot] · 9 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] · 7 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.