openclaw - 💡(How to fix) Fix Gateway path returns "incomplete terminal response" for all anthropic models — affects all gateway-routed channels (Telegram, TUI, terminal) [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#81575Fetched 2026-05-14 03:30:44
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

All gateway-routed model calls return "FailoverError: ended with an incomplete terminal response" while direct (non-gateway) infer calls succeed, on a fresh install with a verified-working Anthropic API key.

Error Message

Local-path success: $ openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi" model.run via local provider: anthropic model: claude-opus-4-7 outputs: 1 Hi! 👋 How can I help you today?

Gateway-path failure (identical command + --gateway flag): $ openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi" --gateway GatewayClientRequestError: FailoverError: anthropic/claude-opus-4-7 ended with an incomplete terminal response

Gateway internal log (excerpt): warn agent/embedded {"event":"embedded_run_agent_end","isError":true,"error":"401 [gzipped binary]","failoverReason":"auth","model":"claude-opus-4-7","provider":"anthropic","providerRuntimeFailureKind":"unclassified"} warn model-fallback/decision {"reason":"auth","status":401,"errorPreview":"401 [gzipped binary garbage]","errorHash":"sha256:dc142751f96c","fallbackStepFinalOutcome":"chain_exhausted"}

Note: error body in logs is binary/gzip-encoded and not human-readable — possibly an undecoded compressed Anthropic response.

Anthropic console usage page confirms requests landing at the timestamps of the failed gateway calls and being billed against the same key (~$1.58 cumulative during debugging).

Root Cause

Affected: All gateway-routed channels and CLI paths — Telegram bot, openclaw chat, openclaw terminal, any direct gateway client. Local-path openclaw infer model run (no --gateway) still works. Severity: High — blocks the primary use case (Telegram bot replies). Direct CLI is the only working surface. Frequency: 100% (every gateway-routed model call fails identically on this install). Consequence: Telegram bot is unusable. Users see "Something went wrong" on every message. Anthropic credit is still consumed because Anthropic accepts and bills the requests before the gateway misclassifies the response.

Code Example

Local-path success:
  $ openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi"
  model.run via local
  provider: anthropic
  model: claude-opus-4-7
  outputs: 1
  Hi! 👋 How can I help you today?

Gateway-path failure (identical command + --gateway flag):
  $ openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi" --gateway
  GatewayClientRequestError: FailoverError: anthropic/claude-opus-4-7 ended with an incomplete terminal response

Gateway internal log (excerpt):
  warn agent/embedded {"event":"embedded_run_agent_end","isError":true,"error":"401 [gzipped binary]","failoverReason":"auth","model":"claude-opus-4-7","provider":"anthropic","providerRuntimeFailureKind":"unclassified"}
  warn model-fallback/decision {"reason":"auth","status":401,"errorPreview":"401 [gzipped binary garbage]","errorHash":"sha256:dc142751f96c","fallbackStepFinalOutcome":"chain_exhausted"}

Note: error body in logs is binary/gzip-encoded and not human-readable — possibly an undecoded compressed Anthropic response.

Anthropic console usage page confirms requests landing at the timestamps of the failed gateway calls and being billed against the same key (~$1.58 cumulative during debugging).
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

All gateway-routed model calls return "FailoverError: ended with an incomplete terminal response" while direct (non-gateway) infer calls succeed, on a fresh install with a verified-working Anthropic API key.

Steps to reproduce

  1. Fresh install: npm install -g openclaw
  2. Run onboarding with a valid Anthropic API key: openclaw onboard --non-interactive --accept-risk --mode local --auth-choice apiKey --anthropic-api-key "$ANTHROPIC_API_KEY" --gateway-port 18789 --gateway-bind loopback --skip-skills
  3. Start gateway: openclaw gateway --force
  4. In a new terminal, run the local-path test: openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi" — succeeds, Claude replies.
  5. Run the gateway-path test with the same key, same model, same prompt: openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi" --gateway — fails with GatewayClientRequestError: FailoverError: anthropic/claude-opus-4-7 ended with an incomplete terminal response.
  6. Confirm via Anthropic console (https://console.anthropic.com/settings/usage) that the gateway-path request DID reach Anthropic and consumed credit — the model completes the request but the gateway misclassifies the response.

Expected behavior

Gateway-path infer call should return Claude's reply identical to the local-path call, since both target the same registered API key (anthropic:default profile, type api_key) and the same model. Anthropic console confirms the request reaches the API and is billed, so the gateway should be receiving a valid 200 response with content.

Actual behavior

Gateway-path call returns GatewayClientRequestError: FailoverError: anthropic/claude-opus-4-7 ended with an incomplete terminal response. Gateway logs show stopReason=stop, payloads=0 and the gateway internally classifies it as reason: auth, status: 401 despite the request being valid and billed. Raw error body in logs is gzipped/binary garbage that does not appear to be decoded before being surfaced — possible response-handling issue rather than actual auth failure. Affects all gateway-routed flows: Telegram bot returns "Something went wrong while processing your request", openclaw chat errors out, openclaw terminal errors out.

OpenClaw version

2026.5.7 (eeef486)

Operating system

macOS 26.4.1 (Mac17,9)

Install method

npm global

Model

anthropic/claude-opus-4-7 (also reproduced with anthropic/claude-sonnet-4-5)

Provider / routing chain

anthropic/claude-opus-4-7 (also reproduced with anthropic/claude-sonnet-4-5)

Additional provider/model setup details

uth profile registered via documented path: openclaw onboard --auth-choice apiKey --anthropic-api-key. Profile shows correctly in openclaw models auth list as anthropic:default [anthropic/api_key]. Key stored at ~/.openclaw/agents/main/agent/auth-profiles.json under profiles.anthropic:default.key with type "api_key" and provider "anthropic". Anthropic Console (platform.claude.com) confirms the key is valid, active, and being billed during the failing gateway-path calls. Workspace: standard Anthropic Console (not Bedrock, not Vertex). No proxy, no AI gateway, no model router — direct anthropic provider.

Logs, screenshots, and evidence

Local-path success:
  $ openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi"
  model.run via local
  provider: anthropic
  model: claude-opus-4-7
  outputs: 1
  Hi! 👋 How can I help you today?

Gateway-path failure (identical command + --gateway flag):
  $ openclaw infer model run --model anthropic/claude-opus-4-7 --prompt "say hi" --gateway
  GatewayClientRequestError: FailoverError: anthropic/claude-opus-4-7 ended with an incomplete terminal response

Gateway internal log (excerpt):
  warn agent/embedded {"event":"embedded_run_agent_end","isError":true,"error":"401 [gzipped binary]","failoverReason":"auth","model":"claude-opus-4-7","provider":"anthropic","providerRuntimeFailureKind":"unclassified"}
  warn model-fallback/decision {"reason":"auth","status":401,"errorPreview":"401 [gzipped binary garbage]","errorHash":"sha256:dc142751f96c","fallbackStepFinalOutcome":"chain_exhausted"}

Note: error body in logs is binary/gzip-encoded and not human-readable — possibly an undecoded compressed Anthropic response.

Anthropic console usage page confirms requests landing at the timestamps of the failed gateway calls and being billed against the same key (~$1.58 cumulative during debugging).

Impact and severity

Affected: All gateway-routed channels and CLI paths — Telegram bot, openclaw chat, openclaw terminal, any direct gateway client. Local-path openclaw infer model run (no --gateway) still works. Severity: High — blocks the primary use case (Telegram bot replies). Direct CLI is the only working surface. Frequency: 100% (every gateway-routed model call fails identically on this install). Consequence: Telegram bot is unusable. Users see "Something went wrong" on every message. Anthropic credit is still consumed because Anthropic accepts and bills the requests before the gateway misclassifies the response.

Additional information

Tried before filing (none changed the failure mode):

  • openclaw doctor --fix (twice)
  • npm install -g openclaw@latest (confirmed on latest build eeef486)
  • rm sessions.json, rm auth-state.json
  • openclaw gateway --force
  • Multiple launchctl kickstart cycles
  • Full nuclear reinstall: mv ~/.openclaw aside, reran openclaw onboard from scratch
  • Tool profile variations (minimal, messaging)
  • visibleReplies variations (automatic, message_tool)
  • Explicit max_tokens (8192) on model params
  • thinking mode off
  • Both claude-opus-4-7 and claude-sonnet-4-5

Cannot identify last known good version — fresh installation, first ever attempt to use the gateway on this machine.

Possible related: gateway log shows error body as \u001f\b\u0000... (gzip magic bytes) suggesting an Anthropic response that is gzip-encoded but not decoded by the gateway's HTTP client before the response classification path runs. This would explain why the gateway reads a valid response as "incomplete" and labels it 401 — it never decompresses what Anthropic actually sent.

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

Gateway-path infer call should return Claude's reply identical to the local-path call, since both target the same registered API key (anthropic:default profile, type api_key) and the same model. Anthropic console confirms the request reaches the API and is billed, so the gateway should be receiving a valid 200 response with content.

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 Gateway path returns "incomplete terminal response" for all anthropic models — affects all gateway-routed channels (Telegram, TUI, terminal) [1 comments, 2 participants]