Skip to content

Windows: aborted bash tool call can leave a dangling tool_use without tool_result and corrupt the session #21489

Description

@NoahChaos

Description

Summary

An aborted tool call can leave the session in a malformed state where a previous tool_use no longer has a corresponding tool_result. After that, the whole session becomes unusable.

Observed error

messages.69: tool_use ids were found without tool_result blocks immediately after: toolu_bdrk_01BWmoT2NYtjBp4BSo72YRN3

Evidence from local database (opencode.db, table part)

{
  "type": "tool",
  "tool": "bash",
  "callID": "toolu_bdrk_01BWmoT2NYtjBp4BSo72YRN3",
  "state": {
    "status": "error",
    "input": {},
    "raw": "",
    "error": "Tool execution aborted"
  }
}

### Plugins

None / no third-party plugins involved. Reproduced with built-in tools.

### OpenCode version

1.4.0

### Steps to reproduce

1. Start an OpenCode session on Windows Desktop with an Anthropic Claude model.
2. Ask the assistant to run a long inline shell command through the bash tool, especially a long `python -c "..."` or `powershell.exe -Command` command with embedded script text.
3. Let the assistant continue in the same session after the tool attempt fails or gets interrupted.
4. Observe that one tool record may become `Tool execution aborted` with empty `input` and empty `raw`.
5. Continue the same conversation.
6. Eventually the session can become invalid and fail with an error like: `tool_use ids were found without tool_result blocks immediately after`.

Note: I do not have a minimal deterministic repro yet, but this has happened multiple times in real sessions on Windows when the model emits long inline bash commands.

### Screenshot and/or share link

<img width="1131" height="1092" alt="Image" src="https://github.com/user-attachments/assets/c0caca8d-e51b-4f84-a510-b78529e04ab8" />

### Operating System

Windows11

### Terminal

Windows  Desktop

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions