Skip to content

onboard --anthropic-api-key does not persist API key to auth-profiles.json #8481

@f-trycua

Description

@f-trycua

Bug

Running openclaw onboard --install-daemon --non-interactive --accept-risk --anthropic-api-key <key> completes successfully, but the Anthropic API key is not written to the agent's auth-profiles.json file.

This causes the gateway to fail on every inbound message with:

No API key found for provider "anthropic". Auth store: ~/.openclaw/agents/main/agent/auth-profiles.json
(agentDir: ~/.openclaw/agents/main/agent). Configure auth for this agent (openclaw agents add <id>)
or copy auth-profiles.json from the main agentDir.

Steps to reproduce

  1. Fresh macOS VM with Node.js 22, pnpm installed
  2. Clone and build openclaw (pnpm install && pnpm build)
  3. Run onboarding:
    pnpm openclaw onboard --install-daemon --non-interactive --accept-risk --anthropic-api-key sk-ant-...
  4. Onboarding completes successfully, gateway starts
  5. Send a WhatsApp message → agent fails with "No API key found"

Expected behavior

The --anthropic-api-key flag should persist the key to ~/.openclaw/agents/main/agent/auth-profiles.json in the correct format:

{
  "version": 1,
  "profiles": {
    "anthropic:default": {
      "type": "api_key",
      "provider": "anthropic",
      "key": "sk-ant-..."
    }
  }
}

Workaround

Manually create the file:

mkdir -p ~/.openclaw/agents/main/agent
cat > ~/.openclaw/agents/main/agent/auth-profiles.json << 'JSON'
{
  "version": 1,
  "profiles": {
    "anthropic:default": {
      "type": "api_key",
      "provider": "anthropic",
      "key": "YOUR_KEY_HERE"
    }
  }
}
JSON

Then restart the gateway: launchctl kickstart -k gui/$(id -u)/ai.openclaw.gateway

Environment

  • OpenClaw 2026.2.2-3
  • macOS Tahoe (VM via Lume)
  • Node.js 22.22.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions