[BUG] OAuth URL wraps onto two lines in narrow terminals causing "Unknown scope" error on headless Linux
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?
When running claude in a headless SSH terminal with no browser installed,
the OAuth URL is too long and wraps onto a second line. The 'c' shortcut
to copy does not work in SSH terminals. When manually selecting and copying
the wrapped URL, a line break and spaces are inserted in the middle of the
scope parameter.
Pasting this into a browser gives:
"Invalid OAuth Request: Unknown scope: us"
"Invalid OAuth Request: Unknown scope: org:create_"
What Should Happen?
The OAuth URL should be printed as a single unbroken line regardless of terminal width,
so it can be copied and pasted into a browser without modification.
Alternatively, the 'c' shortcut to copy the URL should work in SSH/headless terminals,
or a QR code option should be provided (similar to how gh auth login handles headless setups).
Error Messages/Logs
Invalid OAuth Request
Unknown scope: us
and
Invalid OAuth Request
Unknown scope: org:create_
Steps to Reproduce
- SSH into a headless Linux machine (no browser installed)
- Install Claude Code: curl -fsSL https://claude.ai/install.sh | bash
- Run: claude
- Select Pro/Max login option
- Terminal displays OAuth URL but it wraps onto two lines
- Press 'c' to copy — does not work in SSH terminal
- Manually select and copy the URL — line break and spaces are included
- Paste into browser on another machine
- Browser shows "Invalid OAuth Request: Unknown scope: us" or "Unknown scope: org:create_"
Workaround: paste URL into text editor first, manually delete the spaces/line break,
then paste the clean URL into browser
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Code v2.1.66
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Device: NVIDIA Jetson Orin Nano
OS: Ubuntu 22.04.5 LTS (GNU/Linux 5.15.148-tegra aarch64)
Connection: Headless, accessed via SSH from Mac
The 'c' copy shortcut likely fails because SSH terminals don't support
the clipboard access that Claude Code expects.
The URL line-wrap issue affects all headless Linux users (servers,
Jetson, Raspberry Pi, cloud VMs) — a very common deployment scenario.
Simple fix on Anthropic's end: print the full URL as one unbroken string
using a non-wrapping print method, regardless of terminal width.
Related issue: #20325 (same error, different root cause)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗