Summary
When using a local Ollama model (ollama/lfm2:latest) as fallback, OpenClaw can enter a broken state where it requires auth profile/API key for ollama even though provider is local and reachable. This leads to failover collapse if primary model is invalid/unavailable.
Error shown:
No API key found for provider "ollama"... Configure auth for this agent ... (auth)
This is unexpected for local Ollama usage.
Environment
OpenClaw version: 2026.2.26 (bc50708)
OS: macOS (Apple Silicon)
Node: v22.22.0
Ollama: local daemon at http://127.0.0.1:11434
Model: lfm2:latest (local, no cloud auth expected)
Relevant config snapshot (redacted)
{
"auth": {
"profiles": {
"openai-codex:default": {
"provider": "openai-codex",
"mode": "oauth"
}
}
},
"models": {
"providers": {}
},
"agents": {
"defaults": {
"model": {
"primary": "openai-codex/gpt-5.3-codex",
"fallbacks": ["ollama/lfm2:latest"]
},
"models": {
"openai-codex/gpt-5.3-codex": {},
"ollama/lfm2:latest": { "params": { "num_ctx": 32768 } }
}
}
}
}
Steps to reproduce
- Configure fallback ollama/lfm2:latest.
- Remove or mutate models.providers.ollama during troubleshooting/restart flow.
- Set/leave primary to an invalid model (e.g. openai-codex/does-not-exist-test) so failover triggers.
- Send any message.
- Observe failover error demanding API key/auth profile for ollama.
Expected behavior
Suspected root cause
Fallback resolution path treats ollama as requiring auth profile when provider block is absent/incomplete.
Error classification likely conflates “provider not configured” with “missing API key/auth”.
In local model workflows, this is misleading and blocks recovery.
Suggested fixes
Provider validation before auth checks
If models.providers.ollama is missing, return explicit configuration error:
“Provider ollama not configured” (not auth error).
Local provider auth semantics
For api: "ollama" + loopback baseUrl, allow no-auth mode by default.
Actionable diagnostics
Add remediation hint:
“Add models.providers.ollama with baseUrl and model list”
Avoid suggesting openclaw agents add unless auth is truly required.
Guardrail in models set / startup checks
Warn if a fallback references a provider not present in models.providers.
Workaround
Re-add provider explicitly in ~/.openclaw/openclaw.json:
{
"models": {
"providers": {
"ollama": {
"baseUrl": "http://127.0.0.1:11434",
"api": "ollama",
"apiKey": "ollama-local",
"models": [
{
"id": "lfm2:latest",
"name": "LFM2 (local)",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 32768,
"maxTokens": 32768
}
]
}
}
}
}
Actual behavior
Actual behavior
OpenClaw fails all models with combined errors:
primary: Unknown model: openai-codex/does-not-exist-test
fallback: No API key found for provider "ollama" ... (auth)
Result:
All models failed (2) ... openai-codex/does-not-exist-test ... | ollama/lfm2:latest: No API key found for provider "ollama"...
OpenClaw version
2026.2.26 (bc50708)
Operating system
macOS (Apple Silicon)
Install method
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response
Summary
When using a local Ollama model (ollama/lfm2:latest) as fallback, OpenClaw can enter a broken state where it requires auth profile/API key for ollama even though provider is local and reachable. This leads to failover collapse if primary model is invalid/unavailable.
Error shown:
No API key found for provider "ollama"... Configure auth for this agent ... (auth)
This is unexpected for local Ollama usage.
Environment
OpenClaw version: 2026.2.26 (bc50708)
OS: macOS (Apple Silicon)
Node: v22.22.0
Ollama: local daemon at http://127.0.0.1:11434
Model: lfm2:latest (local, no cloud auth expected)
Relevant config snapshot (redacted)
{
"auth": {
"profiles": {
"openai-codex:default": {
"provider": "openai-codex",
"mode": "oauth"
}
}
},
"models": {
"providers": {}
},
"agents": {
"defaults": {
"model": {
"primary": "openai-codex/gpt-5.3-codex",
"fallbacks": ["ollama/lfm2:latest"]
},
"models": {
"openai-codex/gpt-5.3-codex": {},
"ollama/lfm2:latest": { "params": { "num_ctx": 32768 } }
}
}
}
}
Steps to reproduce
Expected behavior
Suspected root cause
Fallback resolution path treats ollama as requiring auth profile when provider block is absent/incomplete.
Error classification likely conflates “provider not configured” with “missing API key/auth”.
In local model workflows, this is misleading and blocks recovery.
Suggested fixes
Provider validation before auth checks
If models.providers.ollama is missing, return explicit configuration error:
“Provider ollama not configured” (not auth error).
Local provider auth semantics
For api: "ollama" + loopback baseUrl, allow no-auth mode by default.
Actionable diagnostics
Add remediation hint:
“Add models.providers.ollama with baseUrl and model list”
Avoid suggesting openclaw agents add unless auth is truly required.
Guardrail in models set / startup checks
Warn if a fallback references a provider not present in models.providers.
Workaround
Re-add provider explicitly in ~/.openclaw/openclaw.json:
{
"models": {
"providers": {
"ollama": {
"baseUrl": "http://127.0.0.1:11434",
"api": "ollama",
"apiKey": "ollama-local",
"models": [
{
"id": "lfm2:latest",
"name": "LFM2 (local)",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 32768,
"maxTokens": 32768
}
]
}
}
}
}
Actual behavior
Actual behavior
OpenClaw fails all models with combined errors:
primary: Unknown model: openai-codex/does-not-exist-test
fallback: No API key found for provider "ollama" ... (auth)
Result:
All models failed (2) ... openai-codex/does-not-exist-test ... | ollama/lfm2:latest: No API key found for provider "ollama"...
OpenClaw version
2026.2.26 (bc50708)
Operating system
macOS (Apple Silicon)
Install method
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response