openclaw - 💡(How to fix) Fix `Cannot continue from message role: assistant` after compaction timeout in 2026.5.26

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…

Error Message

[T+0] embedded run auto-compaction start [T+60s] compaction retry aggregate timeout (60000ms): proceeding with pre-compaction state [T+60s] using pre-compaction snapshot: timed out during compaction [T+60s] embedded run failover decision [T+60s] lane task error: lane=main … error="Error: Cannot continue from message role: assistant" [T+60s] lane task error: lane=session:agent:<id>:whatsapp:direct:<num> error=same [T+60s] model fallback decision

Root Cause

Apparent root cause

Code Example

[T+0]      embedded run auto-compaction start
[T+60s]    compaction retry aggregate timeout (60000ms): proceeding with pre-compaction state
[T+60s]    using pre-compaction snapshot: timed out during compaction
[T+60s]    embedded run failover decision
[T+60s]    lane task error: lane=main … error="Error: Cannot continue from message role: assistant"
[T+60s]    lane task error: lane=session:agent:<id>:whatsapp:direct:<num> error=same
[T+60s]    model fallback decision
RAW_BUFFERClick to expand / collapse

Version: 2026.5.26 (10ad3aa) Provider: anthropic/claude-sonnet-4-6 (also seen with fallback chain) Frequency: 42 occurrences in ~3 hours across 4 distinct sessions, on a host that ran 2026.5.18 cleanly for weeks.

Pattern

Each occurrence follows the same sequence in the master log:

[T+0]      embedded run auto-compaction start
[T+60s]    compaction retry aggregate timeout (60000ms): proceeding with pre-compaction state
[T+60s]    using pre-compaction snapshot: timed out during compaction
[T+60s]    embedded run failover decision
[T+60s]    lane task error: lane=main … error="Error: Cannot continue from message role: assistant"
[T+60s]    lane task error: lane=session:agent:<id>:whatsapp:direct:<num> error=same
[T+60s]    model fallback decision

The user-visible result is a generic "Auto-compaction could not recover this turn" delivered to the channel even though the assistant had produced content in the previous turn.

Apparent root cause

After the compaction timeout, the gateway falls back to the pre-compaction snapshot but then ships a prompt whose last message has role: assistant. The Anthropic API correctly rejects this. The fallback path that retries with a different provider hits the same shaped prompt and also fails.

What I tried

  • daemon restart — bug recurs on next message even in a fresh session.
  • Reducing system-prompt bloat (M365 MCP filtered from 125 → 31 tools, schema chars 673k → 116k) — does not fix the role error; only delays compaction triggers.
  • compaction.reserveTokensFloor: 20000 (per upgrade notes) — present, doesn't help.

Reproduces with

  • Long-running session that accumulates tool-call exchanges
  • Bootstrap > 100k tokens (pushes auto-compaction earlier)
  • Sonnet 4.6 primary; same error after fallback to gemini-2.5-flash

Happy to share full anonymized log slice if useful.

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

openclaw - 💡(How to fix) Fix `Cannot continue from message role: assistant` after compaction timeout in 2026.5.26