GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix: Each tool_use block must have a corresponding tool_result block in the next message by i-m-sid · Pull Request #3243 · anomalyco/opencode

Conversation

@i-m-sid

@i-m-sid i-m-sid commented Oct 17, 2025

Copy link
Copy Markdown
Contributor

In rare cases, the ordering of tool calls doesn't match the expected Anthropic API contract. Fixed this by manually ordering the tool calls in expected format.

#2214
#3230
#2720

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisolszewski reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@i-m-sid
fix: Each tool_use block must have a corresponding tool_result block …
d694501
…in the next message
@rekram1-node

rekram1-node commented Oct 17, 2025

Copy link
Copy Markdown
Member

Is it possible to save them in correct format instead, seems weird that for every request we need to reorder all the messages

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@i-m-sid

i-m-sid commented Oct 17, 2025

Copy link
Copy Markdown
Contributor Author

The API itself returns them out of order. It's pretty complicated to save them in correct format while streaming. This replaces .flat() method which I believe is also O(n), so there is no performance hit IMO.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@i-m-sid
i-m-sid marked this pull request as draft October 19, 2025 17:49
@i-m-sid
i-m-sid marked this pull request as ready for review October 19, 2025 19:34
@rekram1-node

rekram1-node commented Oct 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

so the api returns them in an invalid order to send back to api? Hmm are you sure this isnt a bug with pruning tool calls on the opencode side?

I need to look into that api thing but i havent heard that before, Im not saying you are wrong but could you reference the documentation for that here? ill also look into it tho

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node

rekram1-node commented Oct 20, 2025

Copy link
Copy Markdown
Member

ahh i just found: anthropics/claude-code#473

i-m-sid reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@i-m-sid

i-m-sid commented Oct 24, 2025

Copy link
Copy Markdown
Contributor Author

@rekram1-node so what do you think?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node

rekram1-node commented Oct 24, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@i-m-sid let me read over the code and test it

i wish i had a session to read to verify that isnt anything we can solve for in simplier fashion

i-m-sid reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@i-m-sid

i-m-sid commented Oct 25, 2025

Copy link
Copy Markdown
Contributor Author

Sure, will see if I can find a session to test

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@i-m-sid

i-m-sid commented Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

I wasn't able to find any session. We use forked version of opencode in our platform ideavo.ai , and we made this fix more than a month ago. We haven't received the Bad Request issue after that point, which implies it's working.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node

rekram1-node commented Nov 3, 2025

Copy link
Copy Markdown
Member

@i-m-sid I managed to get a session of it, someone sent it to me. It is so funny this is actually still an issue in claude code, but yeah your solution makes sense.

i-m-sid reacted with laugh emoji i-m-sid and chrisolszewski reacted with heart emoji
All reactions
  • 😄 1 reaction
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions
github-actions Bot force-pushed the dev branch from 772b621 to eb855e1 Compare November 10, 2025 05:42
@github-actions
github-actions Bot force-pushed the dev branch 3 times, most recently from f1dc981 to 3e15a39 Compare November 22, 2025 18:07
@thdxr
thdxr force-pushed the dev branch from 3e15a39 to a0831ea Compare November 22, 2025 18:11
@github-actions
github-actions Bot force-pushed the dev branch 3 times, most recently from f8ee907 to 6a9856d Compare November 27, 2025 01:29
@rekram1-node
rekram1-node force-pushed the dev branch from 398b39a to 5013d64 Compare December 5, 2025 05:13
@hendem hendem mentioned this pull request Jan 14, 2026
fix: handle dangling tool_use blocks for LiteLLM proxy compatibility #8497
Closed
@thdxr
thdxr force-pushed the dev branch from cbab81f to 2d3c7a0 Compare January 30, 2026 04:50
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 00637c0 to 71e0ba2 Compare January 30, 2026 14:32
@thdxr
thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@i-m-sid @rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.