opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Provider fix, anthropic Errorhandling if empty image file is read

Open rwese opened this issue 1 month ago • 7 comments

when the agent creates images, by screenshot or otherwise, which produces and file, which is empty, calling the antrophic provider will fail and the chat session is broken, it will not allow you to continue.

Session Export: session_empty_image_.json

The fix will check if there is any content, otherwise return a message to the agent, the test is entirely generated by the ai.

rwese avatar Dec 14 '25 12:12 rwese

just cleaned the git-history

rwese avatar Dec 14 '25 12:12 rwese

/review

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

So I looked at your session, looks like this is related to anthropic, not zen. The code changes you made are for zen api endpoints. This is probably not what you are looking to do..

rekram1-node avatar Dec 14 '25 17:12 rekram1-node

Instead I think we should revert these changes and put the filter in this function: https://github.com/sst/opencode/blob/e6a0a005d6c5e30054b848e931050bb82326efd8/packages/opencode/src/provider/transform.ts#L167

rekram1-node avatar Dec 14 '25 17:12 rekram1-node

@rekram1-node thank you, i will try fixing it there!

rwese avatar Dec 14 '25 17:12 rwese

/review

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

lgtm

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

Nice!

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