[BUG] Remote Web session cannot be created using CLAUDE_CODE_OAUTH_TOKEN
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 using CLAUDE_CODE_OAUTH_TOKEN and claude --remote "test prompt" the user receives:Error: Unable to create remote session
What Should Happen?
It should be possible to trigger a Claude Code Remote Web session using an instance of the CLI (typically in CI/CD) using a CLAUDE_CODE_OAUTH_TOKEN. This allows the session context to be persisted and then pulled down to continue working manually as part of a developer workflow.
Alternatively a way for CI/CD to sync sessions could be a viable solution. Context makes it easier to progress and wastes less tokens working out what's changed.
Error Messages/Logs
2026-02-23T08:47:18.773Z [ERROR] AxiosError: AxiosError: Request failed with status code 401
Looking at the requests claude makes:
/api/oauth/profile403 with a claim error (expected I think since recent changes)/api/claude_code_penguin_mode403/api/oauth/claude_cli/client_data403/v1/messages?beta=true200/v1/messages?beta=true200/v1/environment_providers200/v1/sessions401
What stood out was the 401 vs a 403. The same Authorization token (the value of CLAUDE_CODE_OAUTH_TOKEN is being used for each request).
The response from /v1/sessions is:
{
"error": {
"message": "Authentication failed",
"type": "authentication_error"
},
"request_id": "req_011CYQi8ypDzhs7Z2sZ9ijks",
"type": "error"
}
Steps to Reproduce
- Generate a token
claude setup-token - Set it in a new environment
export CLAUDE_CODE_OAUTH_TOKEN= - Copy ~/.claude.json (specifically oauthAccount.organizationUuid is needed)
- claude --remote "test prompt"
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.50 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Non-interactive/CI environment
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗