[BUG] `defaultMode` setting is ignored

Status Fixed / completed
Reported on v2.1.146
Maintainer reply None cached
Activity 4 comments · opened May 21, 2026 · closed May 21, 2026

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?

The defaultMode setting in settings.json is being ignored.
It should be set to 1M by default, but it keeps changing to Opus 4.7 (which is not 1M), and it is frustrating.

What Should Happen?

The model selection should not change on its own. This did not happen before.

Error Messages/Logs

Steps to Reproduce

It occurs after using it a few times or resuming. I do not know the specific steps. It happens intermittently.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.146 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

4 Comments

yurukusa · 4 months ago

Hi @riya-amemiya — there are likely two separate things mixed together here, and untangling them should give you a working defaults setup.

1. defaultMode controls permission mode, not model selection

The defaultMode field in settings.json belongs to the permissions block and accepts these values:

  • "default", "plan", "acceptEdits", "bypassPermissions", "auto"

Example:

{
  "permissions": {
    "defaultMode": "auto"
  }
}

If you set "defaultMode": "1M" it falls outside the accepted enum and gets silently dropped (this validation gap is itself worth flagging — Claude Code should reject the unknown value with a startup warning instead of silently ignoring it).

**2. To set a default model, use the /model picker (v2.1.144+)**

Per the v2.1.144 release notes (releases page):

/model now changes the model for the current session only; press d in the model picker to set a default for new sessions

So the path is:

  1. Run /model inside the session
  2. Highlight Opus (1M context)
  3. Press d to pin it as the default for new sessions

This default is what new sessions and --resumed sessions should pick up. v2.1.144 also fixed three adjacent regressions that may be relevant if pinning still doesn't stick:

  • "Fixed model selection not applying when changed via the IDE model picker or applyFlagSettings after startup"
  • "Resumed sessions now keep the model they were using instead of picking up another session's /model choice"
  • "Fixed Bedrock and Vertex users unable to select 'Opus (1M context)' from the /model picker (regression in v2.1.129)"

You're on Anthropic API (not Bedrock/Vertex), so the third one shouldn't bite you, but the first two have shipped fixes that should be in v2.1.146.

3. A workaround if d doesn't stick: SessionStart verification hook

If you pin via d and the model still drifts back to Opus 4.7 between sessions, that's a regression worth a separate issue. As a local safety net you can install a SessionStart hook that reads the active model and prints a warning when it's not what you wanted. Something like:

#!/usr/bin/env bash
# ~/.claude/hooks/expected-model-guard.sh
EXPECTED="claude-opus-4-7-1m"   # adjust to whatever ID the picker shows
INPUT=$(cat)
ACTIVE=$(printf '%s' "$INPUT" | python3 -c 'import sys,json; d=json.load(sys.stdin); print(d.get("model",""))')
if [ -n "$ACTIVE" ] && [ "$ACTIVE" != "$EXPECTED" ]; then
  printf '{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"⚠️ Model is %s, expected %s. Run /model to re-pin."}}\n' "$ACTIVE" "$EXPECTED"
fi
exit 0

Register it under hooks.SessionStart in settings.json. It won't change the model — Claude Code chooses that — but it surfaces the divergence immediately so you don't lose hours of work before noticing.

4. The deeper pattern

The frustration you're describing (a configuration surface that says it's set but the runtime quietly does something else) is structural — v2.1.144 alone shipped six fixes in the same shape: silent drop of MCP tool pages, silent /model non-application, silent .mcp.json parse failure, silent worktree losses, etc. Until the settings validator catches the defaultMode mistake at startup, the workaround above is the fastest way to make the silent layer audible.

Hope this helps — please reopen with your exact settings.json snippet if pinning via d doesn't stick, because that would be a fresh regression worth its own report.

riya-amemiya · 4 months ago

@yurukusa

I was mistaken about defaultMode. I apologize.

It certainly seems to have been fixed by following:

So the path is: Run /model inside the session Highlight Opus (1M context) Press d to pin it as the default for new sessions

This was a big help. Thank you very much.

yurukusa · 4 months ago

Glad it worked, @riya-amemiya! The /model UI route is the only path that survives across new sessions — defaultMode was a reasonable guess given the field name overloading. Worth filing a separate issue if you want the settings.json model-default surface to honor a documented key; happy to co-author the structural framing if you do.

Closing the loop here: the tengu_tool_search_unsupported_models: ["haiku"] config (in ~/.claude.json) is worth a look too if you ever route fast tasks through Haiku — same silent-restriction shape as the model-default surface, but at the MCP-tool layer.

Happy to be useful.

github-actions[bot] · 3 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.