[Bug] Terminal Escape Sequences Incorrectly Rendered in Prompt

Status Fixed / completed
Maintainer reply None cached
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"}]

View original on GitHub ↗

14 Comments

github-actions[bot] · 10 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5679
  2. https://github.com/anthropics/claude-code/issues/8376
  3. https://github.com/anthropics/claude-code/issues/6635

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

kylesnowschwartz · 10 months ago

Seems to be occurring as I move from pane to pane or between tabs in Iterm2 (using cmd+<key> as shortcuts)

ryangreenberg · 10 months ago

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.

timtyrrell · 9 months ago

This issue is annoying the hell out of me. I spent the past hour trying to fix it, my findings:

  • The issue happens even with an empty .zshrc file
  • It happens in multiple terminals (Kitty, Terminal.app)
  • It happens with and without tmux
  • The only way I could "fix" it was to place this wonk at the bottom of my .zshrc:
{
  while sleep 0.2; do
    printf '\e[?1004l' 2>/dev/null
  done
} &!

Claude Code appears to enable focus reporting mode (\e[?1004h) and never disables it. A terrible workaround: continuous background process running printf '\e[?1004l'

kylesnowschwartz · 9 months ago

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.

ibejoeb · 9 months ago

I only encounter this when launching vim via ctrl+g.

On Terminal.app, reset fixes it: ⌥ ⌘ R or menu option ShellReset

rob-odwyer · 8 months ago

If 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

gn0rt0n · 8 months ago

I get it every session. GhosTTY with VSCode as IDE (non-plugin).

github-actions[bot] · 7 months ago

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.

raemone · 7 months ago

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

codeaucafe · 7 months ago

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 :(

kylesnowschwartz · 5 months ago

I haven't had this in a while - closing for now - re-open if you're still encountering.

johanhar · 5 months ago

@kylesnowschwartz

This is still a problem for Ghostty with any external editor.

^[[I (focus gained) and ^[[O (focus lost) is leaked into the prompt.

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