openclaw - 💡(How to fix) Fix Agent always returns "Provider returned error" with auto model after gateway restart

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…

Coach agent (Telegram bot) returns "Provider returned error" for every message. curl test to OpenRouter returns HTTP 200 successfully.

Error Message

Coach agent (Telegram bot) returns "Provider returned error" for every message. curl test to OpenRouter returns HTTP 200 successfully. 3. Bot replies with "Provider returned error" 4. Gateway err log shows: [agent/embedded] embedded run agent end: isError=true error=Provider returned error Bot sends "Provider returned error" as reply. Also, gateway restart always overwrites models.json back to model "auto" even after setting via openclaw config set. [agent/embedded] embedded run agent end: isError=true error=Provider returned error

Root Cause

Coach agent (Telegram bot) returns "Provider returned error" for every message. curl test to OpenRouter returns HTTP 200 successfully.

Code Example

gateway.err.log:
[agent/embedded] embedded run agent end: isError=true error=Provider returned error

gateway.log:
[gateway] agent model: openrouter/anthropic/claude-sonnet-4.5
[telegram] [default] starting provider (@phyosweet_assistant_bot)
[telegram] sendMessage ok chat=1921375176 message=4365
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Coach agent (Telegram bot) returns "Provider returned error" for every message. curl test to OpenRouter returns HTTP 200 successfully.

Steps to reproduce

  1. Configure OpenClaw with OpenRouter provider
  2. Send message to Telegram bot
  3. Bot replies with "Provider returned error"
  4. Gateway err log shows: [agent/embedded] embedded run agent end: isError=true error=Provider returned error

Expected behavior

Bot should reply with AI-generated response. curl test to OpenRouter API works fine with HTTP 200.

Actual behavior

Bot sends "Provider returned error" as reply. Also, gateway restart always overwrites models.json back to model "auto" even after setting via openclaw config set.

OpenClaw version

2026.3.2 (85377a2)

Operating system

macOS, Mac Mini M4

Install method

npm global

Model

openrouter/anthropic/claude-sonnet-4-5

Provider / routing chain

openclaw -> openrouter -> anthropic/claude-sonnet-4-5

Additional provider/model setup details

Gateway restart always overwrites ~/.openclaw/agents/main/agent/models.json and resets model to "auto" instead of configured "anthropic/claude-sonnet-4-5". Setting via openclaw config set agents.defaults.model.primary does not persist in models.json after restart.

Logs, screenshots, and evidence

gateway.err.log:
[agent/embedded] embedded run agent end: isError=true error=Provider returned error

gateway.log:
[gateway] agent model: openrouter/anthropic/claude-sonnet-4.5
[telegram] [default] starting provider (@phyosweet_assistant_bot)
[telegram] sendMessage ok chat=1921375176 message=4365

Impact and severity

Affected: Single Telegram bot user (@phyosweet_assistant_bot) Severity: Blocks workflow - bot completely non-functional Frequency: Always - every message fails Consequence: Bot cannot respond to any user messages

Additional information

curl test directly to OpenRouter API with same API key works fine (HTTP 200) for both "auto" and "anthropic/claude-sonnet-4-5" models. Telegram token is valid (getMe returns ok:true). OpenRouter credits $26+ remaining. The issue appears to be in OpenClaw's agent/embedded model resolution.

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…

FAQ

Expected behavior

Bot should reply with AI-generated response. curl test to OpenRouter API works fine with HTTP 200.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Agent always returns "Provider returned error" with auto model after gateway restart