Tool execution aborted when tool call is truncated (empty input) #9055

Open
opened 2026-02-16 18:11:31 -05:00 by yindo · 1 comment
Owner

Originally created by @cjmayoral on GitHub (Feb 11, 2026).

Originally assigned to: @thdxr on GitHub.

snippet-01-tool-aborted.json
snippet-02-message-finish-length.json
snippet-03-session-created.log
snippet-04-llm-model.log
snippet-05-session-cancel-1.log
snippet-06-session-cancel-2.log

Tool execution aborted when tool call is truncated (empty input)

Summary

During session "Resumen T84 antes de continuar" (ses_3b7971163ffexUgX5mjSgXDfWQ), several tool calls ended with Tool execution aborted. One concrete instance shows an edit tool call with empty input ({}) that immediately fails. The same assistant message ended with finish: "length" (output length limit), which suggests the tool call may have been truncated before arguments were fully emitted. This looks like a truncation/cancel edge case rather than an LLM transport failure.

Environment

  • OpenCode version: 1.1.49
  • OS: Windows
  • Model: claude-opus-4-6 (azure-anthropic)
  • Session title: "Resumen T84 antes de continuar"
  • Session ID: ses_3b7971163ffexUgX5mjSgXDfWQ

Evidence (sanitized excerpts)

The following log snippets are attached in snippets/ (redacted paths):

  1. snippet-01-tool-aborted.json — tool call aborted with empty input

  2. snippet-02-message-finish-length.json — same message finished due to output length

  3. snippet-03-session-created.log — session creation (OpenCode 1.1.49)

  4. snippet-04-llm-model.log — model/provider info

  5. snippet-05-session-cancel-1.log — user cancellation (expected behavior)

  6. snippet-06-session-cancel-2.log — user cancellation (expected behavior)

Notes / Hypothesis

  • The tool call is emitted with empty input and immediately aborted.
  • The corresponding assistant message ended with finish: "length", which is consistent with output truncation.
  • This suggests OpenCode may attempt to execute a tool call even when its arguments are incomplete due to truncation.

Expected behavior

If a tool call is truncated (missing or empty input), OpenCode should either:

  • retry the model to complete the tool arguments, or
  • skip tool execution with a clearer error (e.g., "tool call incomplete due to output length"), instead of Tool execution aborted.

Questions for maintainers

  • Is there a guard that detects incomplete tool call payloads before execution?
  • Is there a known interaction between finish: "length" and tool call emission that can cause empty-input tool calls?

Related issues

  • #12233 (closed) — Infinite retry loop when StreamIdleTimeoutError occurs during tool input generation
  • #8312 (closed) — Session corrupted when tool execution is aborted - missing tool_result causes API rejection
  • #1100 (closed) — Tool execution aborted (JSON/tool input parse failure)
  • #11612 (open) — Invalild tool + execution aborted (invalid tool call)
Originally created by @cjmayoral on GitHub (Feb 11, 2026). Originally assigned to: @thdxr on GitHub. [snippet-01-tool-aborted.json](https://github.com/user-attachments/files/25228200/snippet-01-tool-aborted.json) [snippet-02-message-finish-length.json](https://github.com/user-attachments/files/25228203/snippet-02-message-finish-length.json) [snippet-03-session-created.log](https://github.com/user-attachments/files/25228201/snippet-03-session-created.log) [snippet-04-llm-model.log](https://github.com/user-attachments/files/25228204/snippet-04-llm-model.log) [snippet-05-session-cancel-1.log](https://github.com/user-attachments/files/25228202/snippet-05-session-cancel-1.log) [snippet-06-session-cancel-2.log](https://github.com/user-attachments/files/25228205/snippet-06-session-cancel-2.log) # Tool execution aborted when tool call is truncated (empty input) ## Summary During session **"Resumen T84 antes de continuar"** (`ses_3b7971163ffexUgX5mjSgXDfWQ`), several tool calls ended with `Tool execution aborted`. One concrete instance shows an `edit` tool call with **empty input** (`{}`) that immediately fails. The same assistant message ended with `finish: "length"` (output length limit), which suggests the tool call may have been truncated before arguments were fully emitted. This looks like a truncation/cancel edge case rather than an LLM transport failure. ## Environment - OpenCode version: `1.1.49` - OS: Windows - Model: `claude-opus-4-6` (azure-anthropic) - Session title: "Resumen T84 antes de continuar" - Session ID: `ses_3b7971163ffexUgX5mjSgXDfWQ` ## Evidence (sanitized excerpts) The following log snippets are attached in `snippets/` (redacted paths): 1) `snippet-01-tool-aborted.json` — tool call aborted with empty input 2) `snippet-02-message-finish-length.json` — same message finished due to output length 3) `snippet-03-session-created.log` — session creation (OpenCode 1.1.49) 4) `snippet-04-llm-model.log` — model/provider info 5) `snippet-05-session-cancel-1.log` — user cancellation (expected behavior) 6) `snippet-06-session-cancel-2.log` — user cancellation (expected behavior) ## Notes / Hypothesis - The tool call is emitted with empty `input` and immediately aborted. - The corresponding assistant message ended with `finish: "length"`, which is consistent with output truncation. - This suggests OpenCode may attempt to execute a tool call even when its arguments are incomplete due to truncation. ## Expected behavior If a tool call is truncated (missing or empty input), OpenCode should either: - retry the model to complete the tool arguments, or - skip tool execution with a clearer error (e.g., "tool call incomplete due to output length"), instead of `Tool execution aborted`. ## Questions for maintainers - Is there a guard that detects incomplete tool call payloads before execution? - Is there a known interaction between `finish: "length"` and tool call emission that can cause empty-input tool calls? ## Related issues - #12233 (closed) — Infinite retry loop when StreamIdleTimeoutError occurs during tool input generation - #8312 (closed) — Session corrupted when tool execution is aborted - missing tool_result causes API rejection - #1100 (closed) — Tool execution aborted (JSON/tool input parse failure) - #11612 (open) — Invalild tool + execution aborted (invalid tool call)
Author
Owner

@github-actions[bot] commented on GitHub (Feb 11, 2026):

This issue might be related to existing issues addressing similar tool execution failures:

  • #12234: Infinite retry loop when StreamIdleTimeoutError occurs during tool input generation — directly addresses stream truncation causing tool input failures
  • #11612: Invalid tool + execution aborted — discusses tool execution abortion with validation errors

Your report provides additional detail about the truncation → empty input → abort mechanism. The maintainers may consolidate findings across these issues.

@github-actions[bot] commented on GitHub (Feb 11, 2026): This issue might be related to existing issues addressing similar tool execution failures: - #12234: Infinite retry loop when StreamIdleTimeoutError occurs during tool input generation — directly addresses stream truncation causing tool input failures - #11612: Invalid tool + execution aborted — discusses tool execution abortion with validation errors Your report provides additional detail about the truncation → empty input → abort mechanism. The maintainers may consolidate findings across these issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9055