-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Description
Summary
When a tool execution is aborted, the session becomes permanently corrupted. Subsequent messages fail with Anthropic API error: tool_use ids were found without tool_result blocks.
Steps to Reproduce
- Start a conversation that triggers tool calls
- Abort/cancel during tool execution
- Try to continue the conversation in the same session
- API returns error:
messages.N: tool_use ids were found without tool_result blocks immediately after: toolu_XXXXX
Root Cause
When a tool is aborted, the tool call part is saved with status: "error" and error: "Tool execution aborted", but no corresponding tool_result message is created.
From the logs:
ERROR service=session.processor error=The operation was aborted.
stack="abort@[native code]\ncancel@/$bunfs/root/src/cli/cmd/tui/worker.js:..."
The abort happens in oh-my-opencode's worker/session processor, but the tool_result is not properly returned to OpenCode.
Related
- OpenCode issue: AI_APICallError: tool_use blocks found without corresponding tool_result blocks anomalyco/opencode#2720 (same underlying problem)
Impact
- Session becomes unusable after any tool abort
- User must start a new session, losing conversation context
I'd like to work on this fix. Happy to submit a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels