Claude Code paste bug fix — abstract clipboard with broken chain and error symbols in red and orange

Claude Code Login Issue: How to Fix the “Can’t Paste Authentication Code” Error on macOS and Windows

If you just ran claude login, got your authentication code from the browser, and your terminal silently refuses to paste it, you are not doing anything wrong. This was a known regression that started in Claude Code v2.1.105 and persisted through v2.1.107, confirmed by Anthropic’s own changelog and dozens of open bug reports on GitHub. The paste prompt swallowed your input because bracketed paste mode stopped being handled correctly after a v2.1.86 fix for OAuth token masking, and the fallout hit macOS Terminal, iTerm2, Warp, Windows Terminal, PowerShell, and WSL2 at the same time.

The good news: Anthropic shipped an official fix in Claude Code v2.1.108 on April 14, 2026. Updating to the latest version now solves the paste problem for most users. In this guide, we walk you through that update first, then the downgrade path we personally used before the fix landed, plus the official manual login flow and platform-specific workarounds for every major terminal on macOS and Windows. We also share exactly what happened when our own team hit this bug, because the internet is full of bad advice for this one. If you are new to the Claude stack, our guide to Claude Mythos and Project Glasswing is a useful companion piece on what Anthropic is building next.

Fastest fix: update Claude Code to v2.1.108 or later. Run npm install -g @anthropic-ai/claude-code@latest, restart your terminal, and log in again.

The Key Takeaways

  • The Claude Code “can’t paste authentication code” bug is a bracketed paste regression, not an account or clipboard problem.
  • Claude Code v2.1.108 (April 14, 2026) ships the official fix. Update with npm install -g @anthropic-ai/claude-code@latest and the paste prompt works again.
  • The bug affected v2.1.105 through v2.1.107. If updating is not an option, downgrade to v2.1.104, the last clean pre-regression release.
  • The manual backup is the c flow: press c at the login prompt, open the OAuth URL in a browser, paste the returned code back.
  • If nothing else works, set ANTHROPIC_API_KEY in your shell and skip OAuth entirely.

Why You Can’t Paste the Authentication Code in Claude Code

When you run claude or /login, Claude Code opens your browser for an Anthropic OAuth approval, then asks you to paste the returned authentication code into the terminal at the Paste code here if prompted > prompt. Modern terminals wrap pasted text in special escape sequences called bracketed paste (ESC[200~ a ESC[201~). In Claude Code v2.1.105, a change to how masked input was handled broke the parser for those sequences, so pasted codes were silently dropped while typed characters still registered. The same failure returned in v2.1.107, and Anthropic finally resolved it cleanly in v2.1.108. The result, while it lasted, was an empty prompt that would not accept the code no matter how many times you pressed Ctrl+V, Cmd+V, Shift+Insert, or right-click paste.

This is not a clipboard problem, a VPN problem, or an account problem. Your code is fine. Claude Code just is not reading it. That detail matters because most older guides on this error tell you to “paste only the code, not the full URL” or “restart your terminal”, and while those can help in edge cases, they will not fix the underlying regression.

How We Hit This Bug (And What Actually Worked)

We ran into this exact issue the first time we installed Claude Code on a fresh machine, and the fix was not obvious. Here is the path we took, in case yours looks the same.

First, we tried every paste method we could think of. Ctrl+V in Windows Terminal did nothing. Shift+Insert did nothing. Right-click paste did nothing. Cmd+V on the macOS side behaved the same way. The prompt just sat there, blinking, as if the clipboard was empty.

Next, we asked Claude itself what was going on. It suggested the usual suspects: restart the terminal, check the clipboard, try a different shell. None of it changed anything. So we tried typing the code manually, character by character, from the browser URL. Claude Code accepted the input and sent it to Anthropic, which responded with a 401 error. At that point it was clear the problem was not just paste; the code we were typing was being mangled or expiring before it reached the server.

We then checked status.anthropic.com to rule out an outage. Everything was green. No incidents. So we went to the Claude Code GitHub issues tracker and searched the repository, and within a minute we found multiple open issues (#47669, #47745, #47799, #47887) all reporting the same bracketed paste failure starting in v2.1.105. A quick check of Reddit confirmed it; users on r/ClaudeAI were hitting the same wall.

The fix that actually worked for us at the time was to downgrade Claude Code to v2.1.104. Login worked on the first attempt after that. A few days later Anthropic shipped a proper patch in v2.1.108, so updating forward is now the cleaner path, but the downgrade still works if you need it.

Fix 1: Update to Claude Code v2.1.108 or Later (Recommended)

This is the fix Anthropic has now shipped, and it is the cleanest option if you want to stay on a supported release. v2.1.108 (April 14, 2026) properly handles the bracketed paste escape sequences at the /login prompt across every terminal we have tested.

If you installed via npm, run:

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

If you installed via the native installer on macOS or Linux:

curl -fsSL https://claude.ai/install.sh | bash

On Windows PowerShell:

irm https://claude.ai/install.ps1 | iex

After updating, restart your terminal, confirm the version with claude --version, run /logout if you had a stuck session, then claude to trigger a fresh login. Paste should work on the first try.

If your organisation pins Claude Code to an older version, or the bug somehow persists on your machine after the update, move on to Fix 2.

Fix 2: Downgrade Claude Code to v2.1.104

This is the fix that solved it for us during the regression window, and it still works if you cannot update to v2.1.108 for any reason. v2.1.104 is the last clean version before the bracketed paste bug.

If you installed via npm, run:

npm install -g @anthropic-ai/claude-code@2.1.104

If you installed via the native installer on macOS or Linux:

curl -fsSL https://claude.ai/install.sh | bash -s 2.1.104

After downgrading, restart your terminal, run /logout if you had a stuck session, then claude to trigger a fresh login. Paste should work immediately.

Fix 3: Use Anthropic’s Official Manual Login Flow

If you would rather stay on this version, Anthropic’s official Claude Code troubleshooting documentation describes a manual flow that sidesteps the paste field issue. At the Claude Code login prompt, press the c key. This copies the full OAuth URL to your clipboard. Open any browser, paste the URL, complete the Anthropic sign-in, and you will be redirected to a page containing your code.

Copy the code from that page and return to the terminal. Paste should work here in most cases because the prompt is different from the broken input field. If it still does not, type the code manually but do it quickly, within 60 seconds, before the code expires and triggers the dreaded OAuth error: Invalid code. Please make sure the full code was copied message.

Fix 4: Disable Bracketed Paste in Your Terminal

If the regression is the bracketed paste handler, turning bracketed paste off at the terminal level bypasses the bug entirely.

On iTerm2 (macOS): open Settings → Profiles → Terminal and uncheck “Applications in terminal may access clipboard” and any bracketed paste related option. A community workaround that also works is to add this to your ~/.bashrc or ~/.zshrc:

claude() { command claude "$@"; printf '\e[?2004l'; }

On macOS Terminal.app: bracketed paste is controlled by the shell, not the app. Run bind 'set enable-bracketed-paste off' in bash, or add set enable-bracketed-paste off to ~/.inputrc.

On Windows Terminal: some users report "bracketedPaste": false in settings.json helps, though results are mixed. If it does not work, fall back to Fix 1 or Fix 2.

On WSL2: the bracketed paste setting lives in your Linux shell, not Windows. Use the same ~/.inputrc trick as macOS Terminal.

Fix 5: Skip OAuth With an API Key

If you have an Anthropic Console account, you can bypass the login flow entirely.

Grab an API key from console.anthropic.com, then export it before running Claude Code:

export ANTHROPIC_API_KEY=sk-ant-your-key-here
claude

On Windows PowerShell:

$env:ANTHROPIC_API_KEY = "sk-ant-your-key-here"
claude

Claude Code will detect the key and skip OAuth. Useful while you wait for the paste bug to be patched, or if you are on a locked-down machine where browser callbacks are blocked anyway. Note that API key usage is billed per token through your Console account, separate from any Pro or Max subscription, and if you are weighing whether to stay on Claude at all, our roundup of the best Claude Cowork alternatives is a quick sanity check.

Fix 6: Run `claude doctor` and Fully Reset

If none of the above work, your install is in a weird state. Run:

claude doctor

This diagnostic prints your install type, version, and any configuration errors. If it flags authentication issues, fully reset Claude Code:

# macOS / Linux
rm ~/.claude.json
rm -rf ~/.claude/

On Windows:

Remove-Item $env:USERPROFILE\.claude.json -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force $env:USERPROFILE\.claude -ErrorAction SilentlyContinue

Reinstall to the latest v2.1.108+ (or downgrade to v2.1.104) and run claude again.

Paste Behaviour by Terminal

Terminal Default paste Issue in v2.1.105–v2.1.107 Fixed in v2.1.108? Fallback
macOS Terminal Cmd+V Silently dropped Yes Downgrade or disable bracketed paste
iTerm2 Cmd+V Silently dropped Yes Shell wrapper or downgrade
Warp Cmd+V Silently dropped Yes Downgrade to v2.1.104
Windows Terminal Ctrl+Shift+V Silently dropped Yes Downgrade or manual c flow
PowerShell Right-click Silently dropped Yes Downgrade or API key
WSL2 Ctrl+Shift+V Silently dropped Yes ~/.inputrc bracketed paste off

The Official Fix Has Landed

Anthropic shipped a proper patch in Claude Code v2.1.108 on April 14, 2026, after two earlier attempts in the 2.1.105–2.1.107 line failed to fully resolve the bracketed paste handling. Update with npm install -g @anthropic-ai/claude-code@latest, confirm with claude --version, and test the /login paste prompt in your terminal of choice. If paste still fails, fall back to v2.1.104 via Fix 2 or the manual c flow from Fix 3.

If Claude Code keeps giving you trouble and you want to benchmark your options before committing more time, the Muse Spark vs ChatGPT vs Claude vs Gemini comparison shows where each major model wins, and the Grok vs ChatGPT breakdown is a solid reference if you are rethinking your default coding assistant entirely.

Závěr

The Claude Code “can’t paste authentication code” error was the v2.1.105–v2.1.107 bracketed paste regression, not a clipboard, terminal, or account problem. Update to v2.1.108 or later and the paste prompt works again on the first try. If you cannot update, v2.1.104 still runs clean and the manual c copy flow is a reliable fallback. Once you are back in, our guide to AI system instructions will help you get noticeably better output from your first prompt.

FAQ

Why can’t I paste the authentication code in Claude Code?

A regression introduced in Claude Code v2.1.105 that persisted through v2.1.107 broke the terminal’s bracketed paste handling. Pasted input was silently dropped while typed input still registered, so the prompt looked unresponsive. Anthropic fixed it in v2.1.108 on April 14, 2026, so updating to the latest version is the cleanest solution.

Do I still need to downgrade to v2.1.104?

Only if you cannot update to v2.1.108 or later. The v2.1.108 release ships the official fix. If you are pinned to an older version, run npm install -g @anthropic-ai/claude-code@2.1.104 to get a clean pre-regression release.

Does this issue affect Windows, macOS, and WSL equally?

Yes. The regression lives in Claude Code itself, not the terminal, so it hits macOS Terminal, iTerm2, Warp, Windows Terminal, PowerShell, and WSL2. The workarounds are the same across all of them.

Can I log in without pasting anything?

Yes. Set ANTHROPIC_API_KEY in your shell and Claude Code will skip OAuth entirely. You can also press c at the login prompt to copy the OAuth URL, complete login in a browser, and return to the terminal with a fresh code.

Why did I get a 401 error when I typed the code manually?

Authentication codes are short-lived. If you type a 30+ character code by hand, the code often expires or you mistype a character before it reaches Anthropic, which returns a 401. Downgrading, or using c + quick copy-paste, avoids the timing problem.

Share Now!

Facebook
X
LinkedIn
Threads
E-mail

Získejte exkluzivní tipy o umělé inteligenci do své e-mailové schránky!

Získejte náskok díky odborným poznatkům o umělé inteligenci, kterým důvěřují špičkoví technologičtí profesionálové!