[BUG] Arrow keys produce [57319u in Ghostty terminal on Linux (Kitty keyboard protocol)

Resolved 💬 5 comments Opened Feb 3, 2026 by eesb99 Closed Mar 5, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

  • Terminal: Ghostty (Linux, GTK)
  • OS: Ubuntu 24.04 (kernel 6.14.0-37-generic)
  • Shell: Bash
  • Issue: Arrow keys (up/down/left/right) do not work inside Claude Code CLI. Pressing down arrow prints [57319u instead of navigating. Arrow keys work fine in the normal Ghostty shell — the issue only occurs inside Claude Code.

This is the same class of bug as #17040 (numpad Enter producing [57414;129u). Claude Code enables the Kitty keyboard protocol but does not correctly parse the CSI u encoded arrow key sequences that Ghostty sends back.

Attempted Workarounds (none worked)

  1. term = xterm-256color in Ghostty config
  2. keybind = arrow_up=text:\x1b[A (with and without unconsumed: and performable: prefixes)
  3. enquiry-response = in Ghostty config
  4. TERM=dumb claude wrapper
  5. Bash function wrapper: claude() { TERM=xterm-256color command claude "$@"; }

None of these work because Claude Code requests the Kitty protocol directly from the terminal, bypassing Ghostty's keybind overrides.

Workaround: j/k keys work for navigation in vim mode (/vim).

What Should Happen?

Arrow keys should navigate up/down in Claude Code CLI, same as they do in the regular terminal shell.

Error Messages/Logs

[57319u

(57319 = Unicode codepoint for down arrow in Kitty keyboard protocol CSI u encoding)

Steps to Reproduce

  1. Open Ghostty terminal on Ubuntu 24.04
  2. Launch claude (native CLI, v2.1.29)
  3. Press up or down arrow key
  4. Observe [57319u (down) or [57352u (up) printed instead of navigation

Claude Model

Opus 4.5

Is this a regression?

Unknown

Claude Code Version

2.1.29

Platform

Anthropic API

Operating System

Ubuntu 24.04 LTS (Linux 6.14.0-37-generic)

Terminal/Shell

Ghostty + Bash

Additional Information

Related: #17040, #17919
Same root cause as https://github.com/google-gemini/gemini-cli/issues/6227 (Gemini CLI had identical bug, fixed by properly parsing CSI u sequences)

View original on GitHub ↗

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