Skip to content

retry invalid tool-call diff / malformed tool input instead of aborting #15906

Closed as not planned

Description

@pkellyuk

What happened?

During tool execution, the session can abort instead of retrying on transient provider/tool-call parsing failures.

I hit two real error shapes:

  1. Invalid diff: now finding less tool calls!
  2. Invalid input for tool write: JSON parsing failed: Text: ...

When these occur, opencode currently exits the turn instead of recovering.

Steps to reproduce

  1. Run a tool-heavy edit turn where streamed tool-call deltas are produced.
  2. Hit a provider response that emits an invalid intermediate tool-call diff.
  3. Observe abort with Tool execution aborted and Invalid diff: now finding less tool calls!.
  4. In other runs, observe abort on malformed tool input with JSON parsing failed: Text:.

Expected behavior

  • Treat transient invalid tool-call diff errors as retryable.
  • Attempt to repair malformed tool input JSON before giving up.

Additional context

I have a tested fix prepared that:

  • marks invalid tool-call diff errors as retryable
  • repairs malformed JSON tool input (including Text: payloads) and retries the tool call

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 3, 2026
  2. github-actions commented on Mar 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If these don't fully cover your case (especially the Invalid diff: now finding less tool calls! shape), this may still be worth keeping open as a distinct issue.

  3. KingingWang commented on Mar 30, 2026

    @KingingWang

    I also encountered this issue. I think this situation should be retried a few times before terminating when it cannot be recovered.

  4. assigned and unassigned on Apr 26, 2026
  5. tup2339 commented on Apr 28, 2026

    @tup2339

    less than two months, 10000 new issue were added, good suggestions were completely drowned out.

  6. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions