[BUG] Paste race condition: Enter sends message before clipboard content is inserted

Resolved 💬 5 comments Opened Feb 24, 2026 by ppravdin Closed Apr 1, 2026

Description

In recent versions, pasting text into the terminal input has a noticeable lag. If you paste text and press Enter immediately after (as is natural in terminal workflow), the message is sent without the pasted content — because the paste hasn't been processed yet by the time Enter is registered.

Steps to Reproduce

  1. Open Claude Code in terminal
  2. Copy some text to clipboard
  3. Paste (Ctrl+V / Cmd+V) into the input
  4. Press Enter immediately after pasting (within ~200-500ms, normal typing speed)
  5. The message is sent empty or with only whatever was typed before the paste

Expected Behavior

Paste should be processed synchronously (or Enter should be blocked until the paste buffer is fully inserted). In a terminal, paste-then-Enter is a single fluid action — there should be no race condition between clipboard insertion and Enter key processing.

Actual Behavior

There is a delay between pressing paste and the text actually appearing in the input field. If Enter is pressed during this delay, the message sends without the pasted content. The pasted text then appears in the input field after the message has already been sent.

Impact

This is very disruptive in terminal workflow where paste+Enter is muscle memory. You end up sending blank or incomplete messages and have to retype/repaste. Gets worse in longer sessions.

Environment

  • Claude Code CLI (latest versions, regression from earlier builds)
  • Linux terminal (bash)
  • Also reported on macOS and Windows in related issues (#22650, #6210, #8735) but those focus on paste being slow — this is specifically about the race condition where Enter fires before paste completes

Related Issues

  • #22650 — slow paste with session history
  • #6210 — slow text paste regression
  • #8735 — copy-paste lag
  • #21152 — lag pasting large text blocks

Those issues describe paste being slow. This issue is specifically about the race condition: paste lag + Enter = message sent without pasted content.

View original on GitHub ↗

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