KBCodeKB
Unverified

Fix Claude Code /login Auth Code Paste Failure: Terminal Paste Bracketing Regression (v2.1.105-v2.1.106) in iTerm2, VS Code, WSL2, and Dev Containers

Claude Code v2.1.105 introduced a regression where the /login auth code prompt ('Paste code here if prompted >') rejects pasted text when the terminal has paste bracketing enabled. This affects all non-browser OAuth flows: Dev Containers (where browser callback can't reach the container), SSH sessions, WSL2, and any terminal supporting paste bracketing (iTerm2, VS Code integrated terminal, Zed, Windows Terminal, etc.). The only authentication method for these environments — manually pasting the auth code — is completely broken. Combined 161+ reactions and 139+ comments across 3 duplicate issues (#47670, #47699, #47669). Staff-confirmed (rboyce-ant closed #47670), fix shipped in v2.1.107 (published April 14, 2026, same day as closure). Workaround: disable paste bracketing in terminal settings or downgrade to v2.1.104. ## Agent Decision Tree 1. Check current version: `claude --version` - If >= 2.1.107 → already fixed, no action needed - If 2.1.105 or 2.1.106 → affected, choose solution below - If < 2.1.105 → not affected by this regression 2. Determine upgrade feasibility: - If upgrade allowed → Solution 0 (upgrade to latest) - If upgrade blocked but terminal settings accessible → Solution 1 (disable paste bracketing) - If neither possible → Solution 2 (downgrade to v2.1.104)

Symptoms

  • Cannot paste OAuth authorization code into 'Paste code here if prompted >' during /login
  • Ctrl+V, Cmd+V, and Shift+Insert all fail to paste the auth code — nothing happens when pasting
  • Typing the code character-by-character works but pasting is blocked
  • Bug first appeared after upgrading to Claude Code v2.1.105 (April 13, 2026)
  • Affects only the /login auth code prompt — pasting works normally in the main chat input
  • Affected environments: Dev Containers, SSH sessions, WSL2, iTerm2, VS Code terminal, Zed terminal, any terminal with paste bracketing enabled

Error signatures

Paste code here if prompted
cannot paste auth code
paste not accepted
terminal paste bracketing
login paste failure

Possible causes

  • Terminal paste bracketing is a protocol where terminals wrap pasted text with escape sequences (\e[200~ ... \e[201~) to distinguish typed input from pasted input. Many terminal emulators enable this by default: iTerm2, VS Code integrated terminal, Windows Terminal, Zed, Alacritty, Kitty.
  • In v2.1.105, a change to the TUI input handling code caused the /login auth code prompt's input handler to reject text wrapped in paste bracketing escape sequences. The main chat REPL input was not affected because it uses a different input handling path — only the special login prompt ('Paste code here if prompted >') input handler was impacted.
  • For Dev Container, SSH, and WSL2 users, browser-based OAuth callback cannot reach the container/remote host, making manual code paste the ONLY authentication path. This made the regression a complete blocker — users could not authenticate at all without typing the code character-by-character.
  • The regression was introduced between v2.1.104 (published Apr 12, 2026) and v2.1.105 (published Apr 13, 2026). Verify with: `npm view @anthropic-ai/claude-code@2.1.104 time --json | grep 2.1.104` and `npm view @anthropic-ai/claude-code@2.1.105 time --json | grep 2.1.105` — the 24-hour gap confirms the tight regression window.

Solutions

Workaround 2: Downgrade to v2.1.104 (Last Known Working Version Before Regression)

risk: lowgithubpublished

If you cannot upgrade past v2.1.106 and cannot modify terminal settings, downgrade to v2.1.104 (published April 12, 2026) which predates the regression. The paste bracketing bug was introduced in v2.1.105 and fixed in v2.1.107.

  1. Check current version: `claude --version` → confirm it's 2.1.105 or 2.1.106
  2. Uninstall current version: `npm uninstall -g @anthropic-ai/claude-code`
  3. Install v2.1.104: `npm install -g @anthropic-ai/claude-code@2.1.104`
  4. Pin the version to prevent auto-update: if using package.json, set exact version
  5. Verify: `claude --version` → expect '2.1.104'
  6. Run `/login` and paste the auth code — should work normally

Commands

claude --version
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code@2.1.104
claude --version
npm list -g @anthropic-ai/claude-code

Config examples

{
  "package.json dependency pin": {
    "@anthropic-ai/claude-code": "2.1.104"
  }
}

Risks

  • v2.1.104 is ~70 versions behind latest (2.1.177 as of June 2026) — missing security fixes, bug fixes, and features released since April 2026
  • Auto-update mechanisms may silently upgrade unless explicitly blocked
  • Some MCP features and bug fixes from newer versions are unavailable

Verification

  • Step 1: Run `claude --version 2>&1; echo exit=$?` → expect stdout: '2.1.104', exit code 0. If exit code is non-zero, claude is not installed — check npm installation.
  • Step 2: Run `npm list -g @anthropic-ai/claude-code 2>&1; echo exit=$?` → expect stdout containing '@anthropic-ai/claude-code@2.1.104', exit code 0
  • Step 3: Run `/login`, paste auth code → expect: code accepted and authentication succeeds with 'Logged in as ...' message
0 verified0 failed

Workaround 1: Disable Terminal Paste Bracketing (Universal, No Version Change Required)

risk: lowgithubpublished

Disable paste bracketing in your terminal emulator settings. This prevents the terminal from wrapping pasted text in \e[200~ / \e[201~ escape sequences, allowing the auth code to pass through to the input handler unchanged. This is a terminal-level fix that works on all Claude Code versions and is safe to keep disabled for normal use.

  1. Identify your terminal: run `echo $TERM_PROGRAM` (macOS) or check terminal title bar
  2. For iTerm2: Settings → Profiles → [Your Profile] → Terminal → uncheck 'Terminal may enable paste bracketing'
  3. For VS Code: Open Command Palette (Cmd+Shift+P) → 'Preferences: Open Settings (JSON)' → add `"terminal.integrated.enableBracketedPaste": false`
  4. For Windows Terminal: Settings → Profiles → [Your Profile] → Advanced → uncheck 'Enable bracketed paste mode'
  5. For Zed: Settings → search 'bracketed_paste' → set to false
  6. Restart Claude Code and re-run `/login` — paste should now work

Commands

echo $TERM_PROGRAM
echo 'After disabling paste bracketing, run: claude'

Config examples

{
  "VS Code settings.json": {
    "terminal.integrated.enableBracketedPaste": false
  }
}
{
  "iTerm2 GUI path": "Settings → Profiles → Default → Terminal → uncheck 'Terminal may enable paste bracketing'"
}
{
  "Windows Terminal GUI path": "Settings → Profiles → Default → Advanced → 'Enable bracketed paste mode' → Off"
}

Risks

  • Disabling paste bracketing affects ALL terminal applications, not just Claude Code — multi-line paste in some apps may behave differently without bracketing
  • This is a workaround, not a fix — if you later upgrade to a version that also has paste bracketing issues, the problem may recur

Verification

  • Step 1: Run `echo $TERM_PROGRAM 2>&1; echo exit=$?` → identify your terminal (expect: 'iTerm.app', 'vscode', 'Windows Terminal', etc.), exit code 0
  • Step 2: Disable paste bracketing per the terminal-specific instructions above, then restart Claude Code
  • Step 3: Run `/login`, paste the auth code into 'Paste code here if prompted >' → expect: code is immediately pasted and accepted, authentication proceeds normally. If paste still fails, verify the terminal setting change was saved (quit and reopen the terminal completely).
0 verified0 failed

Immediate Fix: Upgrade to v2.1.107+ (Staff-Confirmed Fix, rboyce-ant Closure)

risk: lowofficialpublished

Claude Code v2.1.107 (published April 14, 2026 at 05:18 UTC) fixed the paste bracketing regression in the /login auth code prompt. Anthropic staff member rboyce-ant closed issue #47670 as resolved. All versions v2.1.107 and later accept pasted auth codes correctly, regardless of terminal paste bracketing settings.

  1. Check current version: `claude --version` — if already >= 2.1.107, you are not affected
  2. Upgrade Claude Code: `npm install -g @anthropic-ai/claude-code@latest` or `curl -fsSL https://claude.ai/install.sh | bash`
  3. Verify version after upgrade: `claude --version` → expect >= 2.1.107
  4. Run `/login` and paste the auth code → should be accepted immediately

Commands

claude --version
npm install -g @anthropic-ai/claude-code@latest
claude --version
npm view @anthropic-ai/claude-code version

Risks

  • v2.1.107+ may include other breaking changes; review the changelog before upgrading in production
  • If npm registry is unavailable, use the install script: `curl -fsSL https://claude.ai/install.sh | bash`

Verification

  • Step 1: Run `npm view @anthropic-ai/claude-code version 2>&1; echo exit=$?` → expect stdout containing version string like '2.1.177', exit code 0. If exit code is non-zero, npm registry may be unreachable — try the install script instead.
  • Step 2: Run `claude --version 2>&1; echo exit=$?` → expect output matching >= 2.1.107 (e.g., '2.1.177'), exit code 0. If version is still 2.1.105 or 2.1.106, the upgrade did not take effect — check npm global prefix with `npm prefix -g`.
  • Step 3: Run `/login`, select 'Claude account with subscription', complete browser OAuth, copy the auth code, paste into 'Paste code here if prompted >' → expect: code is pasted and accepted without hanging, authentication completes with 'Logged in as ...' message
0 verified0 failed

Agent JSON

Canonical machine-readable representation of this issue:

{
  "issue_id": "a0a10dbe-7b75-430e-aedb-b587248eb46a",
  "slug": "fix-claude-code-login-auth-code-paste-failure-terminal-paste-bracketing-regression-v2-1-105-v2-1-106-in-iterm2-vs-code-w-hngh8g",
  "verification_status": "unverified",
  "canonical_json": "https://codekb.dev/v1/issues/fix-claude-code-login-auth-code-paste-failure-terminal-paste-bracketing-regression-v2-1-105-v2-1-106-in-iterm2-vs-code-w-hngh8g"
}
← Back to all issuesPowered by CodeKB