/model picker writes ANSI escape fragment (\[1m\) into settings.json model value

Status Closed — duplicate
Reported on v2.1.215
Maintainer reply None cached
Activity 1 comment · opened Jul 19, 2026 · closed Aug 19, 2026

Description

Selecting a model via the interactive /model picker writes an ANSI formatting fragment into the persisted model value in settings.json. After choosing a model, the saved value becomes e.g.:

"model": "claude-fable-5[1m]"

The trailing [1m] is the ANSI "bold on" escape sequence (ESC[1m) with the ESC byte stripped, leaking from the picker's own styled stdout (the confirmation line renders as Set model to <ESC>[1mFable 5<ESC>[22m ...). The [1m portion ends up concatenated onto the saved model id.

Reproduction

  1. Run /model and select any model.
  2. Open ~/.claude/settings.json.
  3. The model field reads claude-<name>[1m] instead of claude-<name>.

Reproduces every time /model is used; correcting the value by hand fixes it until the next /model run re-corrupts it.

Impact

Appears cosmetic — the model still resolves and runs correctly with the malformed value (it is not silently downgraded). But a corrupted model id is fragile: stricter validation in a future version could reject it or fall back silently, and it makes settings.json look broken to anyone reading it.

Environment

  • Claude Code 2.1.215
  • Windows 11, PowerShell
  • Also observed after /model runs that report Set model to <name> and saved as your default for new sessions with <effort> effort.

Suggested fix

Strip ANSI escape sequences from the selected value before persisting it to settings.json (or build the persisted id from the raw model identifier rather than the styled display string).

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗