Terminal freezes when pasting >1KB text while Claude Code is running (PTY layer issue)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Pasting text larger than ~1KB into Cursor’s integrated terminal while Claude Code (CLI) is running causes a complete terminal freeze. No input is accepted and the session must be killed.

Key finding: Stack sampling (macOS sample command) during the freeze shows the Claude Code Node.js process is 99.5% idle (kevent64 wait). The freeze is NOT in Claude Code – it is in Cursor’s PTY/renderer layer.

This does NOT reproduce in VS Code, iTerm2, Antigravity, or Terminal.app with the same text and same Claude Code version.

Steps to Reproduce

  1. Open Cursor 2.6.19
  2. Open the integrated terminal (zsh)
  3. Run claude (Claude Code CLI v2.1.76)
  4. Copy >1KB of text to clipboard
  5. Paste with Cmd+V
  6. Terminal freezes – no input accepted, must kill the terminal session

Note: Short pastes (a few lines) work fine. The issue triggers with longer text.

Expected Behavior

Text should appear as folded paste notation like [Pasted text #1 +N lines] (Claude Code’s bracketed paste handling), or at minimum the terminal should remain responsive.

Operating System

MacOS

Version Information

IDE: Cursor 2.6.19
Electron: 39.4.0
Chromium: 142.0.7444.265
Node.js: 25.2.1
OS: macOS 26.3.1 (25D2128), Apple Silicon (M4 Pro)

Bundled node-pty: 1.1.0-beta42
Bundled @xterm/xterm: 5.6.0-beta.99

For AI issues: which model did you use?

N/A – this is not an AI model issue. It is a terminal/PTY issue triggered by paste input.

For AI issues: add Request ID with privacy disabled

N/A

Additional Information


Diagnostic evidence

Stack sampling (sample <pid> 3) of the Claude Code process during freeze:

2407/2419 samples (99.5%) -> kevent64 (idle event loop)
7/2419 samples -> StreamBase::Write path
5/2419 samples -> timer/callback processing

The Claude Code process is NOT blocked. It is waiting for events normally. The blockage is between Cursor’s PTY host and the terminal renderer.

Settings changes tried (none resolved the freeze)

Setting Result
ignoreBracketedPasteMode: false No effect
enablePersistentSessions: false No effect
persistentSessionScrollback: 0 No effect
scrollback: 500 No effect
gpuAcceleration: "off" No effect
smoothScrolling: false No effect
tabs.enableAnimation: false No effect
Claude Code statusLine disabled No effect
Claude Code terminalProgressBarEnabled: false No effect
Claude Code prefersReducedMotion: true No effect
ENABLE_IDE_INTEGRATION=false No effect
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 No effect
CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 No effect
SessionEnd hook to reset bracketed paste mode No effect on freeze

ptyhost.log observation

Before applying enablePersistentSessions: false:

Persistent process "1": Replaying 1018 chars and 1 size events

This replay was eliminated by disabling persistent sessions, but the freeze persisted – indicating the root cause is deeper in the PTY/renderer pipeline.

Analysis

The root cause appears to be Cursor’s bundled node-pty (1.1.0-beta42) failing to handle backpressure when large paste input is sent to a raw-mode PTY (as used by Claude Code’s Ink TUI). VS Code does not exhibit this issue, likely due to a newer PTY implementation.

Related GitHub Issues (anthropics/claude-code)


Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the report. This is a known issue with the new Terminal tool. There’s a delay between when the command finishes and when the agent notices.

As a workaround, try enabling the Legacy Terminal Tool:

  • Cursor Settings (not VS Code settings) > Agents > Terminal > Legacy Terminal Tool, turn it on
  • Restart Cursor
  • Check if the delay is gone

Other users reported this reduces the extra delay from 10 to 27 seconds down to under one second. Here are similar threads for context:

The team is aware of this issue. If the workaround helps, let me know. If it doesn’t, please share the Request ID from the affected session (chat menu in the top right, then Copy Request ID).

Thanks for the reply, but this is a different issue.

This bug is about manual paste (Cmd+V) into the terminal freezing the PTY – it has nothing to do with the Agent Terminal Tool or command execution delay.

Key differences:

  • No AI agent or Terminal Tool is involved – I’m pasting text directly into the integrated terminal while Claude Code CLI is running

  • The terminal becomes completely unresponsive (not a delay – a permanent freeze requiring session kill)

  • Stack sampling confirms the Claude Code process is idle (99.5% kevent64) – the freeze is in Cursor’s PTY/renderer layer

  • This does NOT reproduce in VS Code with the identical setup

The “Legacy Terminal Tool” workaround is not applicable here since no agent tool is being used.

This appears to be the same root cause as the known node-pty 1.1.0 buffer issue reported here:

VS Code has already upgraded to node-pty 1.2.0 which fixes the non-blocking PTY write handling. Cursor still bundles node-pty 1.1.0-beta42, which causes deterministic data loss / freeze at the ~1018 byte buffer boundary.

Could this be re-triaged as a terminal/PTY dependency update issue?

Thanks for the extra info.

It looks like this is a known bug in Cursor’s built-in node-pty (v1.1.0-beta42). The same root cause is described here: Terminal paste truncation at ~1018 bytes. In that case it shows up as “silent” truncation. In your case it turns into a full hang because Claude Code uses the PTY in raw mode (Ink TUI), so a write error becomes a freeze instead of an unnoticed data loss.

Your debugging confirms this perfectly. The 1 018-byte boundary in ptyhost.log and the 99,5% idle time in the Claude Code process point straight at the PTY layer.

The team is aware. There’s no ETA yet, but your report helps with prioritization since it shows a more severe symptom than what was previously known.

Unfortunately there’s no in-app workaround. For now the most reliable option is to use an external terminal (iTerm2, Terminal.app, etc.) when you need to paste a large block of text into Claude Code.

Thanks for confirming. Good to know the team is aware.

The stack sampling data showing the freeze (not just truncation) in raw-mode PTY should help with prioritization – it’s a more severe symptom than the silent data loss previously reported.

I’ll use an external terminal for long pastes in the meantime. Looking forward to the node-pty update.

1 Like

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.