OpenClaw Empty Response: stopReason=stop payloads=0 Regression
Agent returns empty responses with stopReason=stop and payloads=0 after migrating workspace from 2026.4.15 to 2026.5.7, causing 'incomplete terminal response' errors across all model fallbacks.
🔍 Symptoms
Primary Error Manifestation
When sending any message via Telegram, the bot immediately returns a user-facing error while internal logs show the following sequence:
2026-05-10T13:01:01 [agent/embedded] empty response detected: runId=9f24f18b-... sessionId=758eb35a-... provider=anthropic/claude-sonnet-4-6 — retrying 1/1 with visible-answer continuation
2026-05-10T13:01:04 [agent/embedded] empty response retries exhausted: provider=anthropic/claude-sonnet-4-6 attempts=1/1 — surfacing incomplete-turn error
2026-05-10T13:01:04 [agent/embedded] incomplete turn detected: stopReason=stop payloads=0 — surfacing error to user
2026-05-10T13:01:04 [model-fallback/decision] decision=candidate_failed requested=anthropic/claude-sonnet-4-6 candidate=anthropic/claude-sonnet-4-6 reason=format code=incomplete_result errorPreview="anthropic/claude-sonnet-4-6 ended with an incomplete terminal response"
2026-05-10T13:01:07 [agent/embedded] empty response detected: provider=anthropic/claude-haiku-4-5
2026-05-10T13:01:10 [agent/embedded] empty response retries exhausted: provider=anthropic/claude-haiku-4-5 attempts=1/1
2026-05-10T13:01:10 [model-fallback/decision] fallbackStepFinalOutcome=chain_exhausted
Embedded agent failed before reply: All models failed (2): anthropic/claude-sonnet-4-6: anthropic/claude-sonnet-4-6 ended with an incomplete terminal response (format) | anthropic/claude-haiku-4-5: anthropic/claude-haiku-4-5 ended with an incomplete terminal response (format)User-Facing Errors
The Telegram user receives one of two misleading errors:
- Primary error: "Something went wrong while processing your request. Please try again, or use /new to start a fresh session."
- Billing misattribution: "API provider returned a billing error - your API key has run out of credits or has an insufficient balance."
Diagnostic Indicators
- API key is valid—Anthropic console confirms requests are reaching their servers and tokens are consumed
- Billing shows activity ($0.73 spent, $99.27 remaining) despite empty response errors
- Error is
incomplete_resultformat code, notauthentication_errororrate_limit_exceeded - Both primary model (
anthropic/claude-sonnet-4-6) and fallback (anthropic/claude-haiku-4-5) fail identically - 5/5 message attempts fail with identical error pattern across multiple runIds and sessionIds
Version Regression Context
Last working: 2026.4.15 — workspace functions normally, agent produces replies
First failing: 2026.5.7 — empty responses with stopReason=stop payloads=0🧠 Root Cause
Core Technical Failure
The error sequence indicates that the Anthropic API is returning a valid HTTP 200 response, but with a JSON body containing stopReason=“stop” and an empty content array (payloads=0). This is distinct from a network failure or authentication error—OpenClaw receives what the API considers a complete response, but one with no content.
Failure Sequence Analysis
stopReason=stop with payloads=0 indicates the model reached a stopping condition without generating any output tokens. This can occur when:
- Content filtering triggers silently — The model detects a policy violation during generation and returns an empty response rather than a blocked content error
- System prompt parsing fails — Workspace files (AGENTS.md, IDENTITY.md, etc.) contain syntax or formatting that causes the instruction parser to misconstruct the system prompt
- Tool/function schema mismatch — Tool definitions in the migrated workspace are incompatible with the 2026.5.7 tool-calling schema
- Thinking mode configuration conflict — The
thinking=adaptivesetting introduced in 2026.5.x interacts poorly with certain workspace configurations
Workspace Migration Hypothesis
The workspace was rsynced from ~/.openclaw/workspace/ on 2026.4.15. Key files that control agent behavior include:
AGENTS.md— Agent behavior instructionsIDENTITY.md— Agent persona definitionSOUL.md— Agent soul/core directivesTOOLS.md— Tool capability definitions.openclaw/— Internal configuration state
Schema changes between 2026.4.15 and 2026.5.7 in these files may cause the message construction pipeline to generate malformed prompts that trigger silent content filtering or empty generation.
Evidence Supporting the Hypothesis
- Same API key works on 2026.4.15 with identical workspace files
- API requests successfully reach Anthropic (tokens consumed)
- No payload returns despite valid HTTP 200
- Error is format-related (
incomplete_result), not connectivity-related - Disabling 46 skills during
openclaw setupdid not resolve the issue
Architectural Context
The OpenClaw agent pipeline constructs messages by combining workspace configuration files with runtime context. When these files contain directives incompatible with the 2026.5.7 instruction parser, the model may produce no output rather than generating an error message—likely because the empty completion is valid according to the API contract but useless to the agent.
🛠️ Step-by-Step Fix
Primary Solution: Reset Workspace Configuration
Since the issue is workspace-specific (migration from 2026.4.15), the workspace files contain incompatible directives. Perform a targeted reset:
# 1. Stop the OpenClaw gateway
openclaw gateway stop
# 2. Backup the existing workspace
mv ~/.openclaw/workspace ~/.openclaw/workspace.bak-2026.05.10
# 3. Create a fresh workspace
mkdir -p ~/.openclaw/workspace
openclaw workspace init
# 4. Re-apply only essential identity from backup
cp ~/.openclaw/workspace.bak-2026.05.10/IDENTITY.md ~/.openclaw/workspace/
cp ~/.openclaw/workspace.bak-2026.05.10/USER.md ~/.openclaw/workspace/
# 5. Verify the fix by starting the gateway
openclaw gateway start
# 6. Send a test message via TelegramAlternative: Selective Workspace File Reset
If you need to preserve workspace memory, identify and reset only the configuration files while preserving memory/state:
# 1. Stop gateway
openclaw gateway stop
# 2. Reset agent configuration files only
cd ~/.openclaw/workspace
mv AGENTS.md AGENTS.md.bak
mv IDENTITY.md IDENTITY.md.bak
mv SOUL.md SOUL.md.bak
mv TOOLS.md TOOLS.md.bak
# 3. Create minimal replacement files
cat > ~/.openclaw/workspace/AGENTS.md << 'EOF'
# Agent Configuration
model: anthropic/claude-sonnet-4-6
EOF
cat > ~/.openclaw/workspace/IDENTITY.md << 'EOF'
# Agent Identity
You are a helpful AI assistant.
EOF
cat > ~/.openclaw/workspace/SOUL.md << 'EOF'
# Agent Soul
Be helpful, concise, and clear in all responses.
EOF
cat > ~/.openclaw/workspace/TOOLS.md << 'EOF'
# Tools
No custom tools configured.
EOF
# 4. Preserve memory files
# memory/, expenses/, state/ remain untouched
# 5. Restart gateway
openclaw gateway startTemporary Workaround: Downgrade to Last Known Good Version
# 1. Uninstall current version
npm uninstall -g openclaw
# 2. Install last known working version
npm install -g [email protected]
# 3. Restart gateway
openclaw gateway stop
openclaw gateway startDiagnostic Fix: Clear Cached Agent State
# 1. Clear agent state directory
rm -rf ~/.openclaw/agents/main/agent/state/*
rm -rf ~/.openclaw/agents/main/agent/memory/*
# 2. Reset session tracking
rm -f ~/.openclaw/agents/main/agent/sessions.json
# 3. Restart gateway
openclaw gateway stop
openclaw gateway start
# 4. Test with /new session command in Telegram🧪 Verification
Verification Steps
After applying the fix, verify the agent responds correctly:
# 1. Check gateway status
openclaw gateway status
# Expected: gateway running on port 18792
# 2. Check logs for successful response
tail -50 ~/.openclaw/logs/gateway.out.log
# Expected: Look for [agent/embedded] messages WITHOUT "empty response detected"Positive Verification Markers
Look for these entries in gateway.out.log instead of the error pattern:
2026-05-10T14:00:00 [agent/embedded] turn processing complete: provider=anthropic/claude-sonnet-4-6 stopReason=stop
2026-05-10T14:00:00 [agent/embedded] reply constructed successfully: provider=anthropic/claude-sonnet-4-6 tokenCount=XXXNegative Verification (Should NOT Appear)
# These patterns should be ABSENT after the fix:
grep "empty response detected" ~/.openclaw/logs/gateway.err.log
# Exit code should be 1 (not found) for recent entries
grep "incomplete turn detected" ~/.openclaw/logs/gateway.err.log
# Exit code should be 1 (not found) for recent entries
grep "stopReason=stop payloads=0" ~/.openclaw/logs/gateway.err.log
# Exit code should be 1 (not found) for recent entriesTelegram Test
# Send a test message via Telegram bot
# Expected: Bot returns a normal conversational response within 10-30 seconds
# NOT: "Something went wrong..." or "billing error..."API Token Verification
# Verify Anthropic console shows token consumption with meaningful output
# (not just empty completion token counting)
# Expected: Input tokens > 0, Output tokens > 0 (not just input tokens)⚠️ Common Pitfalls
- Incomplete workspace rsync — If migrating workspace, ensure all
.openclaw/internal files are also transferred; partial transfers can cause schema mismatches - Stale process references — After restarting gateway, ensure no orphaned Node.js processes hold references to old workspace files (
pkill -f openclaw && openclaw gateway start) - Auth profile stale tokens — Clear
~/.openclaw/agents/main/agent/auth-profiles.jsonand re-authenticate if migration includes stale credentials - Image model interference — The separate
google/gemini-2.5-flash-image-previewimage model path may have its own configuration that triggers empty responses; temporarily disable viaopenclaw models set-image none - Thinking mode with certain prompts —
thinking=adaptiveintroduced in 2026.5.x may interact with migrated workspace directives; explicitly setthinking=offin agent settings - Bash completion parsing in SOUL.md — If SOUL.md or AGENTS.md contains bash-style variable expansions or heredocs, these may be re-parsed incorrectly in 2026.5.7; escape or rewrite such content
- Docker volume mounts — If running OpenClaw in Docker, workspace volume mounts may cache old files; use
docker volume rmand recreate - Node version mismatch — 2026.5.7 may require a specific Node.js version; verify with
node --versionand upgrade if necessary
🔗 Related Errors
| Error Code | Description | Relationship |
|---|---|---|
incomplete_result | Format error indicating API returned incomplete response | Primary error code from this issue |
empty_response_retries_exhausted | Internal retry mechanism failed to recover from empty API response | Directly follows empty response detection |
chain_exhausted | All fallback models in the chain failed | Terminal state after all models fail |
authentication_error | Invalid API key or expired credentials | Distinguished from this issue (API key is valid) |
rate_limit_exceeded | Anthropic API rate limiting | Distinguished by token consumption evidence |
billing_error | Misleading user-facing error for empty responses | User-visible manifestation of this bug |