-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Description
Description
After session compaction in Telegram group chats, the LLM request fails with:
LLM request rejected: messages.X.content.1: unexpected tool_use_id found in tool_result blocks: toolu_XXXXX.
Each tool_result block must have a corresponding tool_use block in the previous message.
Steps to Reproduce
- Add OpenClaw bot to a Telegram group
- Have extended conversations with tool calls
- Wait for auto-compaction to trigger (or manually
/compact) - Try to send a new message in the group
Expected Behavior
Compaction should maintain valid tool_use/tool_result pairs or remove both together.
Actual Behavior
Compaction removes tool_use blocks but leaves orphaned tool_result blocks, which violates Anthropic API requirements.
Environment
- OpenClaw version: 2026.2.2-3
- Compaction mode: safeguard
- Channel: Telegram groups
- Model: claude-opus-4-5
Workaround
Delete the corrupted session file:
rm /root/.openclaw/agents/main/sessions/<session-id>.jsonlSuggested Fix
During compaction, ensure tool_use and tool_result blocks are either both kept or both removed together.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels