Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context is screwed up when a tools call fails. #1102

Closed
jasonkneen opened this issue Feb 5, 2025 · 0 comments
Closed

Context is screwed up when a tools call fails. #1102

jasonkneen opened this issue Feb 5, 2025 · 0 comments

Comments

@jasonkneen
Copy link

◐ Caching cosmic calculations... 2025-02-05T22:45:37.704356Z ERROR goose::agents::truncate: Error: Request failed: Request failed with status: 400 Bad Request. Message: messages.156: Did not find 1 tool_result block(s) at the beginning of this message. Messages following tool_use blocks must begin with a matching number of tool_result blocks.
at crates/goose/src/agents/truncate.rs:279

Ran into this error: Request failed: Request failed with status: 400 Bad Request. Message: messages.156: Did not find 1 tool_result block(s) at the beginning o
f this message. Messages following tool_use blocks must begin with a matching number of tool_result blocks..

Please retry if you think this is a transient or recoverable error.

jasonkneen added a commit to jasonkneen/maverick that referenced this issue Feb 5, 2025
Fixes block#1102

Update error handling in `TruncateAgent` to handle missing `tool_result` blocks.

* **`crates/goose/src/agents/truncate.rs`**
  - Ensure messages following `tool_use` blocks begin with matching `tool_result` blocks.
  - Add logic to provide a descriptive error message when a `tool_result` block is missing.

* **`crates/goose/src/message.rs`**
  - Add a new function `has_tool_result` to check if a message contains a `tool_result` block.

* **`crates/goose/tests/truncate_agent.rs`**
  - Add a new test case to verify the handling of missing `tool_result` blocks.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/block/goose/issues/1102?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants