[BUG] Stray "[<u" escape sequences output to terminal on startup/shutdown

Resolved 💬 5 comments Opened Jan 14, 2026 by jaidhyani Closed Jan 15, 2026

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

  1. Open a yakuake
  2. Run claude
  3. Observe u or uu characters appear before the Claude UI loads
  4. Exit Claude (Ctrl+D twice)
  5. Observe uu characters 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 claude command)
  • 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 [<u sequences)

Workaround

None known. The stray characters are cosmetic but visually confusing.

View original on GitHub ↗

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