opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Tool use id bug

Open leoisadev8 opened this issue 1 week ago • 7 comments

Description

I uploaded 2 images and a short message, got hit with this error.

Image

OpenCode version

1.0.167

Steps to reproduce

  1. Upload 2 images with ctrl + v
  2. Add a short message
  3. Click enter

Screenshot and/or share link

Image

Operating System

macOS 26.2

Terminal

Ghostty

leoisadev8 avatar Dec 18 '25 15:12 leoisadev8

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

  • #2720: AI_APICallError: tool_use blocks found without corresponding tool_result blocks
  • #1662: AI_APICallError: tool_use ids were found without tool_result blocks immediately after
  • #1279: AI_APICallError: messages.1.content.2: tool_use ids must be unique
  • #1150: AI_APICallError: tool_use ids must be unique
  • #4077: In Memory Image can't be Pasted in Opencode After TUI Upgrade (image-related issues)
  • #5101: Switching from an image supported model to a non-image model breaks the thread (image handling)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 18 '25 15:12 github-actions[bot]

ill look into it

rekram1-node avatar Dec 18 '25 15:12 rekram1-node

Image

How do I replicate?

I saw ur description but I think this prolly has to do w/ ordering and whatnot

If u could export session: opencode export > session.json it'd be amazing

rekram1-node avatar Dec 18 '25 15:12 rekram1-node

https://gist.github.com/deriegle/db117ea51f6f55e814e855541bcd47ee

I ran into this too. I had a longer session and was on the main branch in my repo. I had a few files staged and ran /rmslop (same as in opencode) and ran into this bug. I opened a new session and ran /rmslop and got the error again. The gist above is from the second session.

Image

EDIT: realizing the way mine happened was different (no images uploaded) but the error was similar in case that's helpful. Otherwise we can mark this as unrelated.

deriegle avatar Dec 19 '25 06:12 deriegle

@deriegle can u give me the raw json export tho? opencode export > session.json

rekram1-node avatar Dec 19 '25 06:12 rekram1-node

Sorry about that. I've added the session.json into this gist: https://gist.github.com/deriegle/db117ea51f6f55e814e855541bcd47ee

Several of the calls outputted my entire files since it was diffing them, I obfuscated the file names & outputs. If those end up being required to debug this, I can find another way to share that.

deriegle avatar Dec 19 '25 08:12 deriegle

https://gist.github.com/Mishkun/02648359700010e559f7edf6bc8ac4dd

@rekram1-node I finally got this on a pet project, so I can share one in the full

Mishkun avatar Dec 23 '25 15:12 Mishkun