/model command captures ANSI escape codes in model name (Warp terminal)
Bug Description
The built-in /model slash command captures ANSI terminal formatting codes into the model name string, resulting in invalid model IDs like opus[1m] (instead of opus) and claude-opus-4-6[1m] (instead of claude-opus-4-6).
This causes immediate API Error: Rate limit reached on the next prompt because the API receives an invalid model ID.
Environment
- Claude Code: v2.1.49
- Terminal: Warp
- OS: macOS (Darwin 25.3.0)
- Plan: Claude Max
Steps to Reproduce
- Launch Claude Code in Warp terminal
- Run
/model - Select any model (e.g., Opus)
- Observe the confirmation message shows
opus[1m]instead ofopus - Send any message — get
API Error: Rate limit reached
Expected Behavior
/model should set the model to opus (clean string, no ANSI codes).
Actual Behavior
/model sets the model to opus[1m] — the [1m] is the ANSI bold escape sequence being literally captured instead of rendered/stripped.
The corrupted value also gets persisted to ~/.claude/settings.json:
"model": "opus[1m]"
This means subsequent sessions also launch with the broken model ID until manually fixed.
Workaround
Manually edit ~/.claude/settings.json and set "model": "opus" (or "sonnet"). Avoid using /model in Warp until fixed.
Additional Context
The [1m] pattern is consistent with ANSI SGR bold formatting. Warp terminal may handle escape sequences differently than other terminals, causing the model selector's output to leak formatting into the stored value.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗