Text "GOK" appears in the prompt at startup in iTerm2 (kitty graphics query reply not consumed)

Status Open
Reported on v2.1.291
Maintainer reply None cached
Activity 2 comments · opened Oct 6, 2026

Environment

  • Claude Code 2.1.291 (native install)
  • iTerm2 3.5.11, macOS (Darwin 24.6.0), default profile, TERM=xterm-256color
  • Reproduces with claude --bare and with TERM_PROGRAM, ITERM_SESSION_ID, ITERM_PROFILE and LC_TERMINAL unset

What happens
Every new session starts with the literal text GOK already in the prompt input. I first noticed it around 2026-09-21. My prompt history has entries like GOK/model, where the text was in the box before I typed anything. A plain cat in the same iTerm tab shows nothing, so it only happens when Claude is the foreground program.

Cause (from a recording)
I recorded the session with script -q -k and inspected the bytes. During startup Claude sends a kitty graphics capability query:

ESC _ Gi=31,s=1,v=1,a=q,t=d,f=24;AAAA ESC \

iTerm replies with an APC sequence whose payload is GOK:

ESC _ GOK ESC \

The other startup replies in the same exchange are handled correctly: the XTVERSION reply (ESC P > | iTerm2 3.5.11 ESC \), the device attributes reply, and the $y mode reports. The APC reply is not recognized as a terminal response, so the framing is dropped and GOK is inserted into the prompt as typed text. The next frame in the recording draws GOK on the input line.

Expected
The APC reply to the graphics query should be consumed silently and never reach the input buffer.

Related
The changelog already has two fixes for terminal replies leaking into the prompt at startup (the ^[[?1;2c capability reply, and replies like 22c over slow connections). This looks like the same class of bug for the APC graphics reply.

Workaround
Clear the line with Ctrl+U after startup.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗