[BUG] Keystrokes typed during startup are not captured
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?
Keystrokes typed while Claude Code is starting up are not being captured, despite the v2.1.10 release notes stating "Improved startup to capture keystrokes typed before the REPL is fully ready."
The observed behavior:
- Type
claudeand press Enter - Immediately start typing additional input
- Characters appear briefly on the terminal
- After about a second, buffer stops accepting any more characters, and pauses for a bit before the claude UI shows up.
- Claude Code REPL starts with an empty buffer - none of the typed input was captured
What Should Happen?
Keystrokes typed after pressing Enter (while Claude Code is loading) should be captured and appear in the input buffer once the REPL becomes ready, as described in the v2.1.10 release notes.
Video reproduction
https://github.com/user-attachments/assets/ad544e8b-c442-4b91-adee-b19116d4261f
Error Messages/Logs
Steps to Reproduce
- Open a terminal
- Type
claudeand press Enter - Immediately start typing (e.g., "hello world")
- Observe the REPL starts with an empty input buffer
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
2.1.11 (Claude Code)
Claude Code Version
2.1.11 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
The v2.1.10 release notes specifically mention:
"Improved startup to capture keystrokes typed before the REPL is fully ready"
This feature does not appear to be working. The terminal briefly shows typed characters, then stops displaying them, and the REPL starts with no captured input.
8 Comments
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I'm affected as well, here is my setup:
OS: macOS
Terminal: iTerm2 v3.6.6
Shell: zsh 5.9 (configuration)
As for the root cause, Claude suggests it could be raw mode:
This comment was generated by Claude Code (claude-opus-4-6) after analyzing the minified source in the npm package.
Analysis: Early Input Capture Mechanism
Claude Code already implements a typeahead buffer for capturing keystrokes during startup. The relevant exported functions are:
startCapturingEarlyInput— enters raw mode and begins buffering stdinstopCapturingEarlyInput— removes the listener and exits raw modeconsumeEarlyInput— calls stop, returns the buffered string (trimmed), and clears the bufferhasEarlyInput/isCapturingEarlyInput— status checksDeobfuscated startup flow
Likely causes of character loss
await import()that must resolve beforestartCapturingEarlyInput()is called. Characters typed during this window are lost because nothing is reading stdin yet and the terminal is still in cooked mode.consumeEarlyInput()callsstop(), which removes the stdin listener and callssetRawMode(false). Then ink independently callssetRawMode(true)and attaches its own listener. Characters typed in between are lost..trim()strips whitespace —consumeEarlyInputtrims the buffer, so leading/trailing spaces are silently dropped.The handoff gap (point 2) is the most likely cause of the reported character loss, since it's a race condition that would manifest inconsistently depending on startup timing.
Affecting me and a few others I work with as well, another data point: https://github.com/anthropics/claude-code/issues/28080
Make sure to 👍 the issue for visibility.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
Still an issue in v2.1.83.
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.