Compaction duplicates advisor server_tool_use blocks; session fails with 400 'server_tool_use ids must be unique per assistant turn'
Status Open
Reported on v2.1.293
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 1 comment · opened Oct 9, 2026
Summary
With the advisor tool enabled, compaction can leave a session permanently broken. Every request fails with:
400 messages.5.content.95: `server_tool_use` ids must be unique per assistant turn
The session can't recover on its own. Retrying, resuming and further turns all send the same history.
Environment
- Claude Code 2.1.293 and 2.1.296, macOS (desktop app Code tab and CLI)
- Advisor enabled (
advisorModelset) - Seen with built-in compaction and with a plugin
session.compacthook
What the transcripts show
Across 30 local sessions with advisor calls in the last 5 days:
- 16 sessions have the same advisor
server_tool_useid written more than once to the session JSONL. - 158 duplicate pairs in total, and every one of them has a
compact_boundarybetween the two copies. - Each copy carries the same
message.idas the original assistant message. - In most sessions the old copy sits before the boundary and is never sent, so nothing breaks. In at least 2 sessions both copies ended up in the post-compaction chain under one
message.id. They merged into one assistant turn, which the API rejects with the error above.
Expected
When building a request, server tool blocks (and their results) should be deduplicated by id within an assistant turn. Alternatively, compaction shouldn't re-write an advisor block that's already in the chain it keeps.
Workaround
Fork the session from a message before the error. Or edit the JSONL so the duplicate entries get a different message.id, which stops them merging.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗