[BUG] Stray "[<u" escape sequences output to terminal on startup/shutdown
Bug Description
Claude Code outputs malformed [<u escape sequences to the terminal during startup and shutdown. These sequences are not recognized by the terminal, causing literal u characters to appear in the terminal output before Claude's UI appears and after it exits.
Environment
- Platform: Linux (Ubuntu, kernel 6.8.0-90-generic)
- Terminal: xterm-256color (yakuake Terminal)
- Claude Code Version: 2.1.7
Steps to Reproduce
- Open a yakuake
- Run
claude - Observe
uoruucharacters appear before the Claude UI loads - Exit Claude (Ctrl+D twice)
- Observe
uucharacters appear after Claude exits
Evidence
Using script -c "claude" typescript.txt to capture terminal output, the following malformed sequences are visible:
On startup (line 20 of capture):
[?2026l[<u[?1004l[?2004l[?25h[2J[3J[H[?25h[?1004l[?2004l[?25l[?2004h[?1004h[<u[?1004l[?2004l...
On shutdown (line 43 of capture):
[?2026l[<u[?1004l[?2004l[?25h[?25h[<u[?1004l[?2004l[?25h
The [<u sequences appear once or twice at startup and twice at shutdown, which matches the observed "uu" output.
Technical Analysis
The [<u sequence appears to be related to CSI u keyboard protocol handling. It occurs immediately after [?2026l (synchronized output disable) and before [?1004l (focus reporting disable) during terminal mode transitions.
The sequence \e[<u is not a valid/recognized escape sequence, so the terminal prints the literal u character while likely consuming or ignoring the \e[< prefix.
Expected Behavior
No stray characters should appear in the terminal before or after Claude Code runs.
Actual Behavior
The characters uu appear:
- Before Claude's UI renders (after running the
claudecommand) - After Claude exits (before the shell prompt returns)
Screenshot
<img width="595" height="268" alt="Image" src="https://github.com/user-attachments/assets/faaed636-730b-448c-acbc-6e624e1a163d" />
Related Issues
- #10375 - Similar escape sequence leakage issue (focus reporting
[I/[O), but different root cause - #17919 - CSI u keyboard protocol support request (possibly related to the
[<usequences)
Workaround
None known. The stray characters are cosmetic but visually confusing.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗