[Bug] Terminal Escape Sequences Incorrectly Rendered in Prompt
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 14 comments · opened Oct 9, 2025 · closed Mar 30, 2026
Bug Description
On the current version, I'm getting some terminal escape sequences in the prompt command line.
<img width="862" height="123" alt="Image" src="https://github.com/user-attachments/assets/921ce6b3-f022-4ca3-bf40-7fce31d070ee" />
**Environment Info*
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.0.13
- Feedback ID: 01d1eaef-d46c-4395-b2e3-1ab43c914576
Errors
[{"error":"AxiosError: Request failed with status code 500\n at iM (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:24:1136)\n at IncomingMessage.<anonymous> (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:29:9845)\n at IncomingMessage.emit (node:events:519:35)\n at IncomingMessage.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n at t51.request (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:31:2129)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async Zb6 (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1742:26948)\n at async Au1 (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1742:26678)","timestamp":"2025-10-09T21:13:39.454Z"},{"error":"AxiosError: Request failed with status code 500\n at iM (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:24:1136)\n at IncomingMessage.<anonymous> (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:29:9845)\n at IncomingMessage.emit (node:events:519:35)\n at IncomingMessage.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n at t51.request (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:31:2129)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async $j1 (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:424:15727)\n at async VX8 (file:///Users/kyle/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2706:24200)","timestamp":"2025-10-09T21:13:42.493Z"}]
14 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Seems to be occurring as I move from pane to pane or between tabs in Iterm2 (using cmd+<key> as shortcuts)
I closed #10202 as a duplicate of this issue. One detail there that I'd add here: I can get into this state readily by using ctrl + g to edit my prompt in VS Code.
This issue is annoying the hell out of me. I spent the past hour trying to fix it, my findings:
Claude Code appears to enable focus reporting mode (\e[?1004h) and never disables it. A terrible workaround: continuous background process running printf '\e[?1004l'
Lol - that is a gross workaround. Why does it work? I too and very annoyed by the persistence of this issue. Occasionally it feels less obvious - but then it comes back.
I only encounter this when launching vim via ctrl+g.
On Terminal.app, reset fixes it:
⌥ ⌘ Ror menu optionShell→ResetIf anyone else runs into this problem with iTerm2, I found a setting that appears to prevent it. I assume the focus reporting is actually used for something (notifications when prompts appear maybe?), so there's probably a tradeoff there.
<img width="944" height="294" alt="Image" src="https://github.com/user-attachments/assets/8fc5e395-6141-4b0f-9462-7979912e9dda" />
Note: This will only take effect in a new terminal session (e.g. a tab or window, not a Claude Code session), because focus reporting will already have been turned on. You can manually turn it off for the current session with Session -> Terminal State -> Focus Reporting
I get it every session. GhosTTY with VSCode as IDE (non-plugin).
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.
this is still a problem for me - once claude is launched I got those [O and ]I in the console every time it gains / loses focus
still having this issue on both ghostty and JetBrains (GoLand) terminal. Disappeared for a couple weeks but came back with recent versions and has been occurring for 3 weeks straight since :(
I haven't had this in a while - closing for now - re-open if you're still encountering.
@kylesnowschwartz
This is still a problem for Ghostty with any external editor.
^[[I(focus gained) and^[[O(focus lost) is leaked into the prompt.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.