[BUG] ESC key corrupts input state — submitted prompt disappears, requires chaser prompt, chaser then hangs for 3+ minutes burning ~1K tokens

Status Fixed / completed
Reported on v2.1.59
Maintainer reply None cached
Activity 4 comments · opened Feb 27, 2026 · closed Feb 28, 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?

Pressing ESC at any point during a session corrupts the input buffer state, causing a repeating cycle:

  • Press ESC (to interrupt or for any reason)
  • Type next prompt and submit — prompt disappears from the UI with no response
  • Send a throwaway "chaser" prompt (e.g. "hi") — the original prompt now appears and Claude answers it correctly
  • The chaser prompt then fires, consuming ~1,000 tokens
  • Claude hangs for 3+ minutes with no visible activity
  • User presses ESC to break out — and the cycle repeats from step 1

What Should Happen?

ESC interrupts cleanly. The next submitted prompt is processed normally with no input state corruption.

Error Messages/Logs

Steps to Reproduce

  1. Start a Claude Code session
  2. Press ESC at any point (during input, during a response, etc.)
  3. Type a prompt and hit Enter
  4. Observe prompt disappears with no response
  5. Send any follow-up message
  6. Observe original prompt processes correctly, then chaser hangs

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.59 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

4 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/28346
  2. https://github.com/anthropics/claude-code/issues/20431
  3. https://github.com/anthropics/claude-code/issues/17502

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

el-jefe-9000 · 7 months ago
  1. Reproducible in clean environment. Tested with env -i zsh --no-rcs — no shell hooks, no config, bare terminal. The bug persists, so environment/config is not a factor. This is reproducible in Claude Code itself.
  2. Scope is broader than originally reported. The disappear→chaser pattern occurs on the very first prompt of every new session, before any ESC interaction. ESC during a session re-triggers the same broken state, but ESC is not the initiating cause.
el-jefe-9000 · 7 months ago

Resolved — root cause identified: orphaned caffeinate process
The bug was caused by a caffeinate process outlasting the shell hook that spawned it. The orphaned process was interfering with terminal input state, producing the disappear/chaser pattern. Killing the caffeinate process resolved the issue immediately. Not a Claude Code bug.

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