[BUG] Terminal Paste Corruption from Bracketed Paste Mode
Summary
Launching and exiting Claude Code corrupts terminal paste functionality. All subsequent paste operations are prefixed with 00~ and suffixed with 01~.
Environment
- OS: macOS - Sequoia 15.5
- Terminal: Terminal.app 2.14
- Claude Code Version: 1.0.44
- Shell: bash 5.2.37
Reproduction
- Open fresh terminal
- Verify paste works normally
- Run
claude - Exit immediately (no commands)
- Copy/paste any text
Expected vs Actual
Expected: adding-mcp-to-your-python-project
Actual: 00~adding-mcp-to-your-python-project01~
Workarounds
resetprintf '\e[?2004l'- Restart terminal
Technical Details
Claude Code leaves terminal in corrupted bracketed paste mode. The 00~/01~ characters are escape sequences (\e[200~/\e[201~) being displayed instead of processed.
Impact
- Frequency: 100% reproducible
- Trigger: Every Claude Code launch/exit
- Effect: Breaks all terminal paste until manual reset
Root Cause
Claude Code likely enables bracketed paste mode (\e[?2004h) but fails to disable it (\e[?2004l) on exit.
Related
Related:
- https://gitlab.com/gnachman/iterm2/-/issues/7908
- https://jdhao.github.io/2021/02/01/bracketed_paste_mode/
Environment Info
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 1.0.44
- Feedback ID: b21fac8e-2c0a-4d59-b6a5-9ef693b97ece
Errors
[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:892:11)\n at execSync (node:child_process:964:15)\n at wD (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n at file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9350\n at Q (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n at uC (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:8496)\n at hC (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:7361)\n at wB (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11970)","timestamp":"2025-07-08T05:52:40.983Z"},{"error":"SyntaxError: Unexpected token '/', \"/usr/local\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:9971\n at Q (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n at gQA.<anonymous> (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2586:111)\n at gQA.B [as _actionHandler] (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:516:528)\n at file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:520:3127\n at gQA._chainOrCall (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:520:1694)\n at gQA._parseCommand (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:520:3103)\n at gQA.parseAsync (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:517:4195)\n at Cv6 (file:///Users/jason/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2598:1217)","timestamp":"2025-07-08T05:52:41.063Z"}]
Same here
Dup of #3007 ? FWIW you can temporarily fix this by typing this into the shell
printf '\e[?2004l'
Might want to add that as an alias...
Same here!
Here's how to use @jscalo's workaround automatically.
In your .bashrc put:
claude() {
command claude "$@"
printf '\e[?2004l'
}
@thomasnormal This little function is awesome, thanks! Totally fixed it on my end.
I'm experiencing similar bracketed paste mode issues in v2.0.59 when using voice-to-text accessibility software (Handy).
The terminal scrollback clearly shows [201~ (the paste END marker) appearing raw in the input prompt, indicating the bracketed paste sequence isn't being properly consumed. After several paste attempts, the CLI hangs permanently and requires kill -9.
Documented with timestamps and process diagnostics in #13183.
This also affects PowerShell Core in Ghostty. It has a slightly different effect than the original report above. It prefixes the pasted text with 200~ (instead of 00~) and suffixes it with 201~ (instead of 01~).
i.e. pasting in the URL to this issue after exiting Claude Code:
200~https://github.com/anthropics/claude-code/issues/3134201~
Version info:
- Claude Code 2.0.64
- PowerShell Core 7.5.4
- macOS 26.1
- Ghostty 1.2.3
Issues in iTerm too. This is extremely annoying. The alias fixes it, but sheesh this needs to be fixed.