openclaw - 💡(How to fix) Fix [Bug]: Compaction fails with 404 when using anthropic-vertex provider — URL routing mismatch [1 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#63287Fetched 2026-04-09 07:55:51
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Compaction summarization fails with a 404 error when the primary or compaction model uses the anthropic-vertex provider. The compaction code path routes through completeSimple()anthropic-messages API provider → appends /v1/messages to the Vertex base URL, which returns a Google 404 page. Normal chat streaming works because it uses the AnthropicVertex SDK override.

Error Message

Compaction failed: Summarization failed: 404 <!DOCTYPE html>
<html lang=en>
<title>Error 404 (Not Found)!!1</title>
...
The requested URL <code>/v1/messages</code> was not found on this server.

Root Cause

The issue is a URL routing mismatch between the main streaming path and the compaction summarization path:

Fix Action

Workaround

Set agents.defaults.compaction.model to a non-Vertex model:

{
  "agents": {
    "defaults": {
      "compaction": {
        "model": "your-local-provider/some-model"
      }
    }
  }
}

This routes compaction through a provider that uses standard OpenAI-compatible endpoints, avoiding the Vertex URL mismatch entirely. Summarization doesn't require a frontier model.

Code Example

Compaction failed: Summarization failed: 404 <!DOCTYPE html>
<html lang=en>
<title>Error 404 (Not Found)!!1</title>
...
The requested URL <code>/v1/messages</code> was not found on this server.

---

pi-embedded-CNTNdlGw.js:24114
if (params.model.provider === "anthropic-vertex") return createAnthropicVertexStreamFnForModel(params.model)
new AnthropicVertex({ region, projectId })  // from @anthropic-ai/vertex-sdk
Correctly builds: https://us-east5-aiplatform.googleapis.com/v1/projects/{project}/locations/{region}/publishers/anthropic/models/{model}:rawPredict

---

compaction.jsgenerateSummary()completeSimple()
→ @mariozechner/pi-ai/dist/stream.jsresolveApiProvider(model.api)
→ model.api = "anthropic-messages" → registers streamAnthropic / streamSimpleAnthropic
→ @mariozechner/pi-ai/dist/providers/anthropic.js → uses standard Anthropic SDK
Constructs: ${model.baseUrl}/v1/messages
→ https://us-east5-aiplatform.googleapis.com/v1/messages → 404

---

{
  "agents": {
    "defaults": {
      "compaction": {
        "model": "your-local-provider/some-model"
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

[Bug]: Compaction fails with 404 when using anthropic-vertex provider — URL routing mismatch

Summary

Compaction summarization fails with a 404 error when the primary or compaction model uses the anthropic-vertex provider. The compaction code path routes through completeSimple()anthropic-messages API provider → appends /v1/messages to the Vertex base URL, which returns a Google 404 page. Normal chat streaming works because it uses the AnthropicVertex SDK override.

Version

OpenClaw 2026.4.8 (9ece252)

Environment

  • OS: macOS 15 (arm64), Mac Studio M4 Max
  • Model: anthropic-vertex/claude-opus-4-6
  • Auth: Service Account ADC (GOOGLE_APPLICATION_CREDENTIALS)
  • Region: us-east5 (via GOOGLE_CLOUD_LOCATION)
  • Install: npm (global)

Steps to Reproduce

  1. Configure anthropic-vertex as your primary model provider
  2. Set agents.defaults.compaction.model to anthropic-vertex/claude-opus-4-6 (or leave it defaulting to the primary model)
  3. Accumulate enough context to trigger compaction, or run /compact
  4. Compaction fails with 404

Error

Compaction failed: Summarization failed: 404 <!DOCTYPE html>
<html lang=en>
<title>Error 404 (Not Found)!!1</title>
...
The requested URL <code>/v1/messages</code> was not found on this server.

Root Cause Analysis

The issue is a URL routing mismatch between the main streaming path and the compaction summarization path:

Main streaming (WORKS):

pi-embedded-CNTNdlGw.js:24114
→ if (params.model.provider === "anthropic-vertex") return createAnthropicVertexStreamFnForModel(params.model)
→ new AnthropicVertex({ region, projectId })  // from @anthropic-ai/vertex-sdk
→ Correctly builds: https://us-east5-aiplatform.googleapis.com/v1/projects/{project}/locations/{region}/publishers/anthropic/models/{model}:rawPredict

Compaction summarization (BROKEN):

compaction.js → generateSummary() → completeSimple()
→ @mariozechner/pi-ai/dist/stream.js → resolveApiProvider(model.api)
→ model.api = "anthropic-messages" → registers streamAnthropic / streamSimpleAnthropic
→ @mariozechner/pi-ai/dist/providers/anthropic.js → uses standard Anthropic SDK
→ Constructs: ${model.baseUrl}/v1/messages
→ https://us-east5-aiplatform.googleapis.com/v1/messages → 404

The AnthropicVertex SDK override that correctly handles Vertex URL construction is only applied in the main agent streaming loop (createBoundaryAwareStreamFnForModel / registerProviderStreamForModel), not in the completeSimple() path used by compaction.

Key files:

  • dist/pi-embedded-CNTNdlGw.js line 24114 — streaming override (works)
  • dist/anthropic-vertex-stream-BGBzq7ah.jsAnthropicVertex client creation
  • dist/provider-catalog-Dh2qD5Tx.js line 49 — base URL construction
  • node_modules/@mariozechner/pi-coding-agent/dist/core/compaction/compaction.jsgenerateSummary()
  • node_modules/@mariozechner/pi-ai/dist/stream.jscompleteSimple() routing

Suggested Fix

The anthropic-messages API provider registration (in register-builtins.js) needs to be aware of Vertex routing, OR completeSimple() needs to check for model.provider === "anthropic-vertex" and route through the AnthropicVertex SDK, the same way the main streaming path does.

Workaround

Set agents.defaults.compaction.model to a non-Vertex model:

{
  "agents": {
    "defaults": {
      "compaction": {
        "model": "your-local-provider/some-model"
      }
    }
  }
}

This routes compaction through a provider that uses standard OpenAI-compatible endpoints, avoiding the Vertex URL mismatch entirely. Summarization doesn't require a frontier model.

Impact

High — Compaction is completely broken for anyone using anthropic-vertex as their primary provider without a model override. Sessions that hit the compaction threshold will fail silently and the error surfaces as a system notification.

extent analysis

TL;DR

The most likely fix for the compaction failure with a 404 error when using the anthropic-vertex provider is to modify the completeSimple() path to route through the AnthropicVertex SDK for Vertex models.

Guidance

  • Identify the completeSimple() function in stream.js and add a conditional check for model.provider === "anthropic-vertex" to route through the AnthropicVertex SDK.
  • Update the anthropic-messages API provider registration in register-builtins.js to be aware of Vertex routing.
  • As a temporary workaround, set agents.defaults.compaction.model to a non-Vertex model to avoid the URL mismatch.
  • Verify the fix by triggering compaction and checking for successful summarization.

Example

// Update agents.defaults.compaction.model to a non-Vertex model as a workaround
{
  "agents": {
    "defaults": {
      "compaction": {
        "model": "your-local-provider/some-model"
      }
    }
  }
}

Notes

The provided fix assumes that the AnthropicVertex SDK override is correctly handling Vertex URL construction. If issues persist, further investigation into the SDK and its integration with the completeSimple() path may be necessary.

Recommendation

Apply the workaround by setting agents.defaults.compaction.model to a non-Vertex model, as this provides a temporary solution to avoid the URL mismatch and allows for successful compaction and summarization.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING