claude-code - 💡(How to fix) Fix [BUG] Desktop app auto-switches model to claude-opus-4-7[1m] without user input (ANSI escape leak) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53332Fetched 2026-04-26 05:18:28
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Fix Action

Workaround

Manually run /model claude-opus-4-6 after each occurrence.

Code Example

{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T16:45:46.340Z","entrypoint":"claude-desktop"}
{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T16:45:46.341Z","entrypoint":"claude-desktop"}

---

{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T17:49:43.406Z","entrypoint":"claude-desktop"}
{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T17:49:43.406Z","entrypoint":"claude-desktop"}

---

{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T18:33:18.771Z","entrypoint":"claude-desktop"}
{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T18:33:18.772Z","entrypoint":"claude-desktop"}
RAW_BUFFERClick to expand / collapse

Bug Description

The Claude Desktop app (v2.1.119, macOS) automatically runs /model claude-opus-4-7[1m] without any user input, overriding the user's configured model (claude-opus-4-6). This happens repeatedly — observed 3+ times in a single day across different sessions.

Key Observations

EvidenceDetail
ANSI leakModel name includes [1m] (ANSI bold escape fragment), suggesting internal terminal output is leaking into the command parser
Duplicate executionAlways fires exactly twice, within 1ms — indicates a duplicate event handler registration
No user triggerUser did not type /model. Confirmed by checking: keybindings.json (absent), settings.json (set to claude-opus-4-6), hooks (only notification hooks), plugins, and skills — none contain model-switching logic
Desktop-onlyAll occurrences have entrypoint: "claude-desktop" in the JSONL log

Reproduction Evidence (JSONL)

Three separate sessions on the same day, same pattern:

Session 1 (16:45:46 UTC):

{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T16:45:46.340Z","entrypoint":"claude-desktop"}
{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T16:45:46.341Z","entrypoint":"claude-desktop"}

Session 2 (17:49:43 UTC):

{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T17:49:43.406Z","entrypoint":"claude-desktop"}
{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T17:49:43.406Z","entrypoint":"claude-desktop"}

Session 3 (18:33:18 UTC):

{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T18:33:18.771Z","entrypoint":"claude-desktop"}
{"type":"user","message":{"content":"<command-name>/model</command-name>\n<command-args>claude-opus-4-7[1m]</command-args>"},"timestamp":"2026-04-25T18:33:18.772Z","entrypoint":"claude-desktop"}

Environment

  • App: Claude Desktop v2.1.119
  • OS: macOS (Darwin 25.4.0), MacBook Air M1
  • Configured model: claude-opus-4-6 in ~/.claude/settings.json
  • Plugins: visualize@careerhackeralex, telegram@claude-plugins-official (neither contains model-switching code)

Expected Behavior

The model should remain claude-opus-4-6 as configured in settings.json. No /model command should be executed without explicit user input.

Actual Behavior

The desktop app silently runs /model claude-opus-4-7[1m], switching the active model to opus-4-7. The [1m] ANSI bold fragment in the model name suggests the app is parsing its own terminal-formatted output and feeding it back as a command.

Workaround

Manually run /model claude-opus-4-6 after each occurrence.

extent analysis

TL;DR

The issue can be temporarily mitigated by manually running /model claude-opus-4-6 after each occurrence, but a permanent fix requires addressing the ANSI leak and duplicate event handler registration.

Guidance

  • Investigate the source of the ANSI leak, potentially related to terminal output parsing, to prevent the [1m] fragment from being included in the model name.
  • Review event handler registrations to identify and remove duplicates, ensuring that the /model command is only executed once per user input.
  • Verify that the settings.json file is correctly configured with the desired model (claude-opus-4-6) and that no other plugins or hooks are overriding this setting.
  • Consider adding logging or debugging statements to track the execution of the /model command and identify the root cause of the issue.

Example

No code snippet is provided as the issue is more related to configuration and event handling rather than a specific code error.

Notes

The provided workaround may not be practical for long-term use, and a more permanent solution is needed to address the underlying issues. The ANSI leak and duplicate event handler registration suggest a more complex problem that requires careful investigation and testing.

Recommendation

Apply the workaround of manually running /model claude-opus-4-6 after each occurrence until a permanent fix can be implemented, as it allows the user to maintain control over the model selection.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Desktop app auto-switches model to claude-opus-4-7[1m] without user input (ANSI escape leak) [1 comments, 2 participants]