claude-code - 💡(How to fix) Fix [BUG] [Claude Desktop] Cowork VM agent sessions don't receive credentials (gateway mode or Bedrock direct mode)

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…

Error Message

Gateway mode - VM SDK sends Bedrock invoke format with no auth:

[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/claude-sonnet-4-6/invoke-with-response-stream source=sdk
API error: 403 The security token included in the request is invalid.

Bedrock direct mode - VM SDK sends request with no auth, key format rejected:

[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/us.anthropic.claude-sonnet-4-5-20250929-v1:0/invoke-with-response-stream source=sdk API error (attempt 1/11): 403 {"Message":"Invalid API Key format: Base64 decoding failed"}

Note: Host process works fine - title generation via Haiku succeeds in both modes.
The key indicator is "has Authorization header: false" on every VM request.

Root Cause

When configuring Cowork with either a third-party LLM gateway (inferenceGateway) or Bedrock direct credentials, the host process successfully authenticates (e.g., title generation via Haiku works), but the VM-based agent sessions fail with 403 errors because credentials are not passed to the Claude Code SDK running inside the VM.

Code Example

Gateway mode - VM SDK sends Bedrock invoke format with no auth:                                                                                                                      
                                                                                                                                                                                       
  [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false                                                                              
  [API REQUEST] /model/claude-sonnet-4-6/invoke-with-response-stream source=sdk                                                                                                        
  API error: 403 The security token included in the request is invalid.                                                                                                                
                                                                                                                                                                                       
  Bedrock direct mode - VM SDK sends request with no auth, key format rejected:                                                                                                        
                                                                                                                                                                                       
  [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false                                                                              
  [API REQUEST] /model/us.anthropic.claude-sonnet-4-5-20250929-v1:0/invoke-with-response-stream source=sdk
  API error (attempt 1/11): 403 {"Message":"Invalid API Key format: Base64 decoding failed"}                                                                                           
                                                                                                                                                                                       
Note: Host process works fine - title generation via Haiku succeeds in both modes.                                                                                                   
  The key indicator is "has Authorization header: false" on every VM request.
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?

When configuring Cowork with either a third-party LLM gateway (inferenceGateway) or Bedrock direct credentials, the host process successfully authenticates (e.g., title generation via Haiku works), but the VM-based agent sessions fail with 403 errors because credentials are not passed to the Claude Code SDK running inside the VM.

What Should Happen?

When Cowork is configured with third-party gateway credentials (via claude_desktop_config.json inferenceGateway) or Bedrock direct credentials (via UI settings), both the host process and the VM-based agent sessions should authenticate successfully. Specifically, the Claude Code SDK running inside the VM should receive the same credentials/configuration as the host process and include a valid Authorization header in API requests.

Error Messages/Logs

Gateway mode - VM SDK sends Bedrock invoke format with no auth:                                                                                                                      
                                                                                                                                                                                       
  [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false                                                                              
  [API REQUEST] /model/claude-sonnet-4-6/invoke-with-response-stream source=sdk                                                                                                        
  API error: 403 The security token included in the request is invalid.                                                                                                                
                                                                                                                                                                                       
  Bedrock direct mode - VM SDK sends request with no auth, key format rejected:                                                                                                        
                                                                                                                                                                                       
  [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false                                                                              
  [API REQUEST] /model/us.anthropic.claude-sonnet-4-5-20250929-v1:0/invoke-with-response-stream source=sdk
  API error (attempt 1/11): 403 {"Message":"Invalid API Key format: Base64 decoding failed"}                                                                                           
                                                                                                                                                                                       
Note: Host process works fine - title generation via Haiku succeeds in both modes.                                                                                                   
  The key indicator is "has Authorization header: false" on every VM request.

Steps to Reproduce

Gateway mode:

  1. Configure claude_desktop_config.json with:
    {
    "inferenceGateway": {
    "baseUrl": "https://my-litellm-gateway.example.com",
    "inferenceGatewayAuthScheme": "bearer"
    }
    }
  2. Set ANTHROPIC_AUTH_TOKEN with a valid gateway API key
  3. Open Cowork and start a conversation

Bedrock direct mode:

  1. Remove claude_desktop_config.json
  2. Configure Bedrock settings in UI: - AWS region: us-east-1
    - AWS bearer token: <ABSK Bedrock API key>
  3. Start a conversation

Expected Behavior

Both the host process (title generation) and the VM agent session (main conversation) should authenticate successfully using the configured credentials.

Actual Behavior

  • Host process: Works. Title generation (Haiku) completes successfully.
  • VM agent session: Fails with 403. The SDK inside the VM makes requests with no Authorization header.

Debug Evidence

Gateway mode — VM-side SDK uses Bedrock invoke format instead of Anthropic Messages format, with no auth header:

[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/claude-sonnet-4-6/invoke-with-response-stream source=sdk

Bedrock direct mode — Same missing auth, different error:

[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/us.anthropic.claude-sonnet-4-5-20250929-v1:0/invoke-with-response-stream source=sdk
API error: 403 {"Message":"Invalid API Key format: Base64 decoding failed"}

In both modes, has Authorization header: false confirms credentials from the host are not reaching the VM session.

Root Cause Analysis

Cowork's architecture runs agent sessions in an isolated VM. The host process has access to the configured credentials and uses them successfully for lightweight calls (title
generation). However, the VM-side Claude Code SDK instance does not receive these credentials — neither as environment variables nor as configuration. The SDK defaults to Bedrock invoke format (/model/.../invoke-with-response-stream) with no auth, which fails.

Environment

  • Windows corporate environment
  • Backend: Amazon Bedrock (us-east-1) via LiteLLM proxy gateway
  • Gateway: LiteLLM v1.x with Anthropic Messages API → Bedrock translation
  • Bedrock API keys (ABSK format) available
  • IAM credentials with bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream permissions confirmed working via Claude Code VS Code extension

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

NA

Platform

Other

Operating System

Windows

Terminal/Shell

Other

Additional Information

No response

extent analysis

TL;DR

The most likely fix involves ensuring that the credentials from the host process are properly passed to the VM-side Claude Code SDK instance, either through environment variables or configuration.

Guidance

  • Verify that the ANTHROPIC_AUTH_TOKEN environment variable is set and accessible within the VM.
  • Check the Claude Code SDK documentation to see if there's a way to pass credentials as configuration, potentially through a file or API.
  • Investigate how the host process successfully authenticates and see if a similar approach can be applied to the VM-side SDK instance.
  • Consider modifying the VM setup to include the necessary credentials or configuration for the Claude Code SDK.

Example

No specific code example can be provided without more information on the Claude Code SDK and its configuration options.

Notes

The root cause analysis suggests that the issue lies in the credentials not being passed to the VM-side SDK instance. However, without more information on the SDK's configuration options and the specific environment variables or files used, it's difficult to provide a more detailed solution.

Recommendation

Apply a workaround by modifying the VM setup to include the necessary credentials or configuration for the Claude Code SDK, as the issue is likely due to a missing or incorrect configuration.

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

claude-code - 💡(How to fix) Fix [BUG] [Claude Desktop] Cowork VM agent sessions don't receive credentials (gateway mode or Bedrock direct mode)