claude-code - 💡(How to fix) Fix [BUG] Claude Desktop injects inference-only CLAUDE_CODE_OAUTH_TOKEN that breaks /remote-control [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48378Fetched 2026-04-16 07:01:53
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

Error Message

Error Messages/Logs

Code Example

Remote Control requires a full-scope login token. Long-lived tokens (from setup-token or CLAUDE_CODE_OAUTH_TOKEN) are limited to inference-only for security reasons. Run claude auth login to use Remote Control.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Running /remote-control from within Claude Desktop fails with "Remote Control failed to connect: Remote Control initialization failed". Running claude remote-control --verbose reveals the cause: "Remote Control requires a full-scope login token. Long-lived tokens (from claude setup-token or CLAUDE_CODE_OAUTH_TOKEN) are limited to inference-only." Claude Desktop injects a CLAUDE_CODE_OAUTH_TOKEN (inference-only sk-ant-oat-... token) into the process environment. Running claude auth login succeeds but the injected env var overrides the full-scope credentials. Clearing the env var from child shells doesn't affect the parent Claude Code process. Restarting PC doesn't help — Desktop re-injects on launch.

What Should Happen?

/remote-control should work from within Claude Desktop. Either the Desktop app should inject a full-scope token, or claude auth login should take precedence over the injected env var.

Error Messages/Logs

Remote Control requires a full-scope login token. Long-lived tokens (from setup-token or CLAUDE_CODE_OAUTH_TOKEN) are limited to inference-only for security reasons. Run claude auth login to use Remote Control.

Steps to Reproduce

  1. Open Claude Code via Claude Desktop app on Windows
  2. Run /remote-control
  3. Observe failure
  4. Run claude auth login in a separate terminal — completes successfully
  5. Return to Desktop session, try /remote-control again — still fails
  6. Verify with echo $env:CLAUDE_CODE_OAUTH_TOKEN in a child shell — shows sk-ant-oat-... injected by Desktop

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.107

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

Claude Desktop (embedded terminal)

Related issues: #16238, #33105, #47811. The CLAUDE_CODE_OAUTH_TOKEN env var is not set in Windows User or System environment variables — it's injected by the Claude Desktop process at launch time.

extent analysis

TL;DR

The most likely fix is to prevent Claude Desktop from injecting an inference-only token, allowing claude auth login to take precedence with a full-scope token.

Guidance

  • Verify that clearing the CLAUDE_CODE_OAUTH_TOKEN environment variable in the child shell doesn't affect the parent Claude Code process, as this might indicate a caching issue.
  • Check if there's an option in Claude Desktop to configure or disable the automatic injection of the CLAUDE_CODE_OAUTH_TOKEN environment variable.
  • Consider manually setting a full-scope token as the CLAUDE_CODE_OAUTH_TOKEN environment variable before running claude remote-control, if possible.
  • Review related issues (#16238, #33105, #47811) for potential workarounds or insights into the token injection behavior.

Example

No specific code example is provided, as the issue revolves around environment variable management and authentication token handling, which is specific to the Claude Code application.

Notes

The exact solution might depend on the internal workings of Claude Desktop and its environment variable injection mechanism, which is not fully detailed in the issue. Additionally, the regression nature of the issue suggests that a previous version of Claude Code handled tokens differently, but without knowing the last working version, it's challenging to provide a precise fix.

Recommendation

Apply a workaround by attempting to disable or configure the automatic injection of the CLAUDE_CODE_OAUTH_TOKEN environment variable in Claude Desktop, allowing claude auth login to provide a full-scope token. This approach is chosen due to the lack of information on how to directly fix the token precedence issue within the current version of Claude Code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING