ClawKit Logo
ClawKitReliability Toolkit

Fix "No API key found for provider anthropic"

This Is Not a Missing Key Problem

If you're using DeepSeek, OpenAI, or any non-Anthropic provider and see this error — don't rotate your API key. The error is caused by a hook that incorrectly assumes you're using Anthropic. The fix is a config change, not a key change.

The session-memory internal hook has a hardcoded dependency on Anthropic's auth profile path (~/.clawdbot/agents/main/agent/auth-profiles.json). When this hook runs, it tries to load an Anthropic API key regardless of your actual provider. If the file doesn't exist or doesn't contain an Anthropic key, you get a false "No API key found" error that blocks your entire agent workflow.

Next Step

Fix now, then reduce repeat incidents

If this issue keeps coming back, validate your setup in Doctor first, then harden your config.

What the Error Looks Like

No API key found for provider "anthropic"
Error loading auth profile: ~/.clawdbot/agents/main/agent/auth-profiles.json
[hook:session-memory] provider auth lookup failed
ENOENT: no such file or directory, open 'auth-profiles.json'

The error appears during agent startup or on the first request. It blocks the entire workflow — the agent never gets to your actual provider because the hook fails first. You may also notice the error references the old ~/.clawdbot/ path (from the pre-rename era), which is another clue that this is a legacy hook issue.

Why This Happens

1

Hardcoded Anthropic dependency in session-memory hook

The session-memory internal hook was written when OpenClaw (then "Clawdbot") only supported Anthropic as a provider. It hardcodes an Anthropic auth profile lookup path. When you use any other provider, this lookup fails and the hook throws an error instead of gracefully skipping.

2

Legacy path reference (~/.clawdbot/)

The auth profile path references ~/.clawdbot/ — the old project directory from before the rename to OpenClaw. Even if you have an Anthropic key configured in the new path, the hook looks in the wrong directory. This is a double bug: wrong provider assumption AND wrong path.

3

Hook runs before provider routing

Internal hooks execute before the provider routing layer. This means the session-memory hook tries to load Anthropic credentials before OpenClaw even checks which provider you're actually using. The hook doesn't have access to your provider config at this stage.

Fix: Disable session-memory Hook

Low-risk fix — 30 seconds

Disabling session-memory only affects cross-session memory persistence. Your agent will still work normally for chat, tasks, and tool use. Most users don't depend on this hook.

Option A — Edit config file
# Step 1: Backup
cp ~/.openclaw/config.json ~/.openclaw/config.json.bak

# Step 2: Add to ~/.openclaw/config.json
{
  "hooks": {
    "internal": {
      "entries": {
        "session-memory": {
          "enabled": false
        }
      }
    }
  }
}

# Step 3: Restart
openclaw gateway restart
Option B — Use CLI config command
openclaw config set hooks.internal.entries.session-memory.enabled false
openclaw gateway restart

What does session-memory do?

The session-memory hook persists agent memory across chat sessions — allowing your agent to "remember" previous conversations. Disabling it means each session starts fresh. For most agent workflows (task automation, coding agents, browser use), this has no impact.

Confirm It's This Issue

Verify all three conditions before applying the fix:

You are NOT using Anthropic as your primary provider

If you ARE using Anthropic and see this error, the issue is a missing API key — not this hook bug. Check your Anthropic key in the config.

Error references auth-profiles.json or "provider anthropic"

The hook-specific error always mentions the auth profile path or the literal string "provider anthropic".

Error persists after re-entering/rotating your actual API key

If re-entering your DeepSeek/OpenAI key doesn't fix it, the error is not about your key. It's the hook.

Check if the hook is the culprit
# Look for session-memory hook errors
openclaw logs --tail 200 | grep -Ei "session-memory|auth-profiles|No API key found.*anthropic"

# Check your actual provider config
openclaw config get provider

Verify the Fix

Post-fix verification
# 1. Doctor should pass
openclaw doctor

# 2. Send a request using your normal provider
# (chat message, agent task, etc.)

# 3. Confirm no anthropic errors in logs
openclaw logs --tail 100 | grep -Ei "No API key found.*anthropic|auth-profiles"
# Expected: no output

If the error is gone and your agent responds normally using your actual provider (DeepSeek, OpenAI, etc.), the fix is confirmed. The session-memory hook is no longer interfering with provider routing.

Re-enable After Upgrade

When you upgrade OpenClaw to a version that fixes issue #2364, you can re-enable session-memory:

Safe Re-enable Checklist

1

Update OpenClaw to the latest version

npm install -g openclaw@latest
2

Re-enable the hook

openclaw config set hooks.internal.entries.session-memory.enabled true
3

Restart gateway

openclaw gateway restart
4

Send a test request and check logs

openclaw logs --tail 50 | grep -i anthropic

If the anthropic error returns after re-enabling, disable the hook again and wait for the next release. Keep the backup config from the fix step.

Still Failing?

If the error persists after disabling the hook, it may be a different issue:

1

Another hook also references Anthropic

Check all hooks: openclaw config get hooks — disable any other hook that references auth-profiles or anthropic.

2

Your provider IS Anthropic

If you actually use Anthropic, the error is real — check your API key: openclaw config get provider.anthropic

3

Stale config cache

Some config changes don't take effect until a full stop/start cycle: openclaw gateway stop && openclaw gateway start

Run the Doctor

npx clawkit-doctor@latest

Checks provider configuration, API key validity, hook state, and gateway health.

Did this guide solve your problem?