f0902944e0
Add comprehensive troubleshooting documentation for OpenClaw auth issues: - All configuration attempts with Ollama and Anthropic - Error messages and findings - Links to relevant GitHub issues and documentation - Recommendations for future attempts Issue: Gateway mode fails with 'No API key found' despite correct auth-profiles.json configuration with both Ollama and real Anthropic API key.
293 lines
8.6 KiB
Markdown
293 lines
8.6 KiB
Markdown
# OpenClaw Troubleshooting Log
|
|
|
|
## Issue Summary
|
|
OpenClaw gateway mode consistently fails with "No API key found for provider 'anthropic'" despite correct configuration of auth-profiles.json with both Ollama and Anthropic API keys.
|
|
|
|
**Date**: 2026-02-09
|
|
**OpenClaw Version**: `ghcr.io/openclaw/openclaw:main` (2026.2.6-3)
|
|
**Environment**: Docker on x86_64 Linux
|
|
|
|
## Errors Encountered
|
|
|
|
### 1. Architecture Mismatch (SOLVED)
|
|
**Error**: `[FATAL tini (7)] exec docker-entrypoint.sh failed: Exec format error`
|
|
|
|
**Cause**: Docker image defaults to ARM64 architecture
|
|
|
|
**Solution**: Add `platform: linux/amd64` to docker-compose.yml
|
|
|
|
```yaml
|
|
services:
|
|
openclaw:
|
|
platform: linux/amd64
|
|
```
|
|
|
|
### 2. Device Pairing Required (SOLVED)
|
|
**Error**: `disconnected (1008): pairing required`
|
|
|
|
**Solution**: Approve pending device pairing requests
|
|
```bash
|
|
docker exec openclaw npx openclaw devices list
|
|
docker exec openclaw npx openclaw devices approve <REQUEST_ID>
|
|
```
|
|
|
|
### 3. API Key Not Found (UNSOLVED)
|
|
**Error**:
|
|
```
|
|
Error: No API key found for provider "anthropic".
|
|
Auth store: /home/node/.openclaw/agents/main/agent/auth-profiles.json
|
|
```
|
|
|
|
**This error persists despite all configuration attempts below.**
|
|
|
|
## Configuration Attempts
|
|
|
|
### Attempt 1: Ollama Integration via Environment Variables
|
|
Added environment variables to docker-compose.yml:
|
|
```yaml
|
|
environment:
|
|
- OPENCLAW_AGENT_PROVIDER=ollama
|
|
- OPENCLAW_AGENT_MODEL=llama3
|
|
- OPENCLAW_OLLAMA_BASE_URL=http://ollama:11434
|
|
```
|
|
**Result**: ❌ Gateway still defaulted to Anthropic
|
|
|
|
### Attempt 2: Main Config with Ollama
|
|
Created `/srv/openclaw/config/config.json`:
|
|
```json
|
|
{
|
|
"agents": {
|
|
"defaults": {
|
|
"provider": "ollama",
|
|
"model": "llama3",
|
|
"authProfile": "ollama"
|
|
}
|
|
},
|
|
"ollama": {
|
|
"baseURL": "http://ollama:11434"
|
|
}
|
|
}
|
|
```
|
|
**Result**: ❌ Gateway ignored configuration
|
|
|
|
### Attempt 3: OpenAI-Compatible Ollama Configuration
|
|
Based on GitHub issues showing Ollama uses OpenAI-compatible API:
|
|
```json
|
|
{
|
|
"models": {
|
|
"providers": {
|
|
"ollama": {
|
|
"baseUrl": "http://ollama:11434/v1",
|
|
"api": "openai-completions",
|
|
"models": ["llama3", "qwen3-coder"]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
**Result**: ❌ Gateway still tried to use Anthropic
|
|
|
|
### Attempt 4: Dummy Anthropic Token for Ollama Redirect
|
|
Created auth-profiles.json with anthropic profile pointing to Ollama:
|
|
```json
|
|
{
|
|
"anthropic": {
|
|
"provider": "openai",
|
|
"baseURL": "http://ollama:11434/v1",
|
|
"apiKey": "sk-ollama-dummy"
|
|
}
|
|
}
|
|
```
|
|
**Result**: ❌ Still complained about missing Anthropic API key
|
|
|
|
### Attempt 5: Real Anthropic API Key (Simple Format)
|
|
```json
|
|
{
|
|
"anthropic": {
|
|
"apiKey": "sk-ant-api03-..."
|
|
}
|
|
}
|
|
```
|
|
**Result**: ❌ Same error
|
|
|
|
### Attempt 6: Provider:Profile Name Format
|
|
Based on GitHub issues showing profile names like "anthropic:claude-cli":
|
|
```json
|
|
{
|
|
"anthropic:default": {
|
|
"provider": "anthropic",
|
|
"apiKey": "sk-ant-api03-..."
|
|
}
|
|
}
|
|
```
|
|
**Result**: ❌ Same error
|
|
|
|
### Attempt 7: Multiple File Locations
|
|
Tried placing auth-profiles.json in:
|
|
- `/srv/openclaw/config/auth-profiles.json` (root level)
|
|
- `/srv/openclaw/config/agents/main/agent/auth-profiles.json` (agent level)
|
|
- Both locations simultaneously
|
|
|
|
**Result**: ❌ Same error regardless of location
|
|
|
|
### Attempt 8: Agent-Specific Config
|
|
Created `/srv/openclaw/config/agents/main/agent/config.json`:
|
|
```json
|
|
{
|
|
"provider": "openai",
|
|
"model": "llama3",
|
|
"authProfile": "anthropic",
|
|
"openai": {
|
|
"baseURL": "http://ollama:11434/v1"
|
|
}
|
|
}
|
|
```
|
|
**Result**: ❌ Same error
|
|
|
|
### Attempt 9: Ollama Launch Command
|
|
Tried using Ollama's built-in OpenClaw launcher:
|
|
```bash
|
|
docker exec ollama ollama launch openclaw --config --model llama3
|
|
```
|
|
**Result**: ✅ Command succeeded and said "Added llama3 to OpenClaw"
|
|
**But**: Gateway mode in Docker still couldn't use it
|
|
|
|
## Files Verified
|
|
|
|
All configurations were verified to be:
|
|
- ✅ Valid JSON (validated with `python3 -m json.tool`)
|
|
- ✅ Correct permissions (`chown 1000:1000`, owned by `node` user)
|
|
- ✅ In correct locations (verified with `docker exec` inside container)
|
|
- ✅ Properly mounted via Docker volumes
|
|
|
|
## Network Verification
|
|
|
|
Confirmed OpenClaw and Ollama connectivity:
|
|
```bash
|
|
docker exec openclaw curl -s http://ollama:11434/api/tags
|
|
# Successfully returned list of available models including llama3
|
|
```
|
|
|
|
Both containers on same network (`npm-network`): ✅
|
|
|
|
## Key Findings
|
|
|
|
### 1. Gateway Mode Default Behavior
|
|
The log message `agent model: anthropic/claude-opus-4-6` appears on every startup regardless of configuration, suggesting gateway mode with `--allow-unconfigured` flag has hardcoded Anthropic as default.
|
|
|
|
### 2. Ollama Integration Method
|
|
Official documentation shows `ollama launch openclaw` is intended for HOST installation, not containerized deployment. The containerized gateway mode may not support Ollama properly.
|
|
|
|
### 3. Auth Profile Format
|
|
GitHub issues show various profile formats:
|
|
- `"anthropic:claude-cli"` with `"mode": "oauth"`
|
|
- `"ollama:local"` with `"token": "..."`
|
|
- `"minimax-cn:default"` with `"provider": "minimax"`
|
|
|
|
None of these formats worked in our containerized setup.
|
|
|
|
## Documentation Links
|
|
|
|
- **OpenClaw GitHub**: https://github.com/openclaw/openclaw
|
|
- **Ollama Integration Docs**: https://docs.ollama.com/integrations/openclaw
|
|
- **OpenClaw + Ollama Setup Guide**: https://openclawai.net/blog/openclaw-ollama-setup
|
|
- **GitHub Discussion #2936**: https://github.com/openclaw/openclaw/discussions/2936 (Ollama usage)
|
|
- **GitHub Issue #3740**: https://github.com/openclaw/openclaw/issues/3740 (Ollama auth check)
|
|
- **GitHub Issue #1253**: https://github.com/openclaw/openclaw/issues/1253 (Auth profile format)
|
|
|
|
## Current Working Configuration
|
|
|
|
### docker-compose.yml
|
|
```yaml
|
|
services:
|
|
openclaw:
|
|
container_name: openclaw
|
|
image: ghcr.io/openclaw/openclaw:main
|
|
platform: linux/amd64
|
|
restart: unless-stopped
|
|
command: ["node", "openclaw.mjs", "gateway", "--allow-unconfigured", "--bind", "lan"]
|
|
environment:
|
|
- HOME=/home/node
|
|
- TERM=xterm-256color
|
|
- TZ=America/New_York
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- OPENCLAW_GATEWAY_TOKEN=27d4e63adce6c8f7c5396e8ca3f9ec5e6ff590077247fb11da03a8684ee3c711
|
|
- OPENCLAW_GATEWAY_BIND=lan
|
|
- VIRTUAL_HOST=openclaw.kolpacksoftware.com
|
|
- VIRTUAL_PORT=18789
|
|
- LETSENCRYPT_HOST=openclaw.kolpacksoftware.com
|
|
volumes:
|
|
- /srv/openclaw/config:/home/node/.openclaw
|
|
- /srv/openclaw/workspace:/home/node/.openclaw/workspace
|
|
init: true
|
|
networks:
|
|
- npm-network
|
|
|
|
networks:
|
|
npm-network:
|
|
external: true
|
|
```
|
|
|
|
### Status
|
|
- ✅ Container runs without crashes
|
|
- ✅ Gateway accessible at https://openclaw.kolpacksoftware.com
|
|
- ✅ WebSocket connections work
|
|
- ✅ Device pairing works
|
|
- ❌ Cannot use any AI model (Ollama or Anthropic)
|
|
|
|
## Possible Causes
|
|
|
|
1. **Docker Image Issue**: The containerized version may have a bug or missing configuration
|
|
2. **Gateway Mode Limitation**: `--allow-unconfigured` flag may bypass auth-profiles.json entirely
|
|
3. **Version-Specific Bug**: This version (2026.2.6-3) may have a regression
|
|
4. **Missing Setup Step**: There may be an initialization step we're missing
|
|
5. **Auth System Design**: The auth system may be designed for host installation only
|
|
|
|
## Recommended Solutions to Try
|
|
|
|
### 1. Install on Host Instead of Docker
|
|
```bash
|
|
npm install -g openclaw@latest
|
|
openclaw onboard --install-daemon
|
|
ollama launch openclaw
|
|
```
|
|
This follows the official documentation more closely.
|
|
|
|
### 2. Try Different Docker Image Tag
|
|
```yaml
|
|
image: ghcr.io/openclaw/openclaw:2026.2.5 # or other specific version
|
|
```
|
|
|
|
### 3. Remove `--allow-unconfigured` Flag
|
|
May require running `openclaw onboard` inside container first (interactive, difficult in Docker).
|
|
|
|
### 4. File GitHub Issue
|
|
Report this configuration with:
|
|
- docker-compose.yml
|
|
- auth-profiles.json attempts
|
|
- Full error logs
|
|
- Ask maintainers for Docker-specific setup guide
|
|
|
|
### 5. Alternative AI Assistants
|
|
- **Open WebUI**: Excellent Ollama integration, easy Docker setup
|
|
- **LibreChat**: Multi-provider support including Ollama
|
|
- Both are well-documented and Docker-friendly
|
|
|
|
## Next Steps
|
|
|
|
Before revisiting:
|
|
1. Check OpenClaw GitHub for updates/fixes related to Docker deployment
|
|
2. Look for new documentation about auth-profiles.json format
|
|
3. Search for successful Docker deployment examples
|
|
4. Consider whether host installation is more appropriate for this use case
|
|
|
|
## Environment Details
|
|
|
|
- **Host OS**: Linux 6.8.0-94-generic (Ubuntu 24.04)
|
|
- **Docker Version**: 28.2.2
|
|
- **Architecture**: x86_64
|
|
- **Ollama Version**: Running in separate container on same network
|
|
- **Ollama Models**: llama3:latest, qwen3-coder, qwen3:8b, gemma3:4b, and others
|
|
- **Network**: npm-network (shared with nginx-proxy)
|