Skip to content

CLI becomes broken after a tool returns an error when using Claude #1600

@trobrock

Description

@trobrock

I was setting up the github mcp and (for some still unknown reason) it's returning a permissions error. When using OpenAI, I see the permissions error, but when using Claude I see this:

2025-03-10T21:05:22.625757Z ERROR goose::agents::truncate: Error: Request failed: Request failed with status: 400 Bad Request. Message: messages.35: Messages containing `tool_use` blocks must be followed by a user message with `tool_result` blocks
    at crates/goose/src/agents/truncate.rs:396

Ran into this error: Request failed: Request failed with status: 400 Bad Request. Message: messages.35: Messages containing `tool_use` blocks must be followed by a user message with `tool_result` blocks.

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

No other prompts succeed after hitting this and I have to close the CLI.

To Reproduce
Steps to reproduce the behavior:

  1. Set your config:
GOOSE_PROVIDER: anthropic
GOOSE_MODEL: claude-3-7-sonnet-latest
extensions:
  github:
    args:
    - -y
    - '@modelcontextprotocol/server-github'
    cmd: npx
    enabled: true
    envs: {}
    name: github
    timeout: 300
    type: stdio
  1. Do not set a github auth token
  2. Make a prompt like "Tell me about this github issue https://github.com/block/fakerepo/issues/1102"

Expected behavior
Show the error like the OpenAI provider does:

Execution failed: RPC error: code=-32603, message=Not Found: Resource not found: Not Found
It seems that the GitHub issue you mentioned does not exist or the repository `block/fakerepo` could not be found. Please make sure the repository and issue number are correct, or check if the repository is private and requires appropriate access permissions.

The CLI should still be usable after the error.

Screenshots
If applicable, add screenshots to help explain your problem.

Please provide following information:

  • OS & Arch: Mac OSX
  • Interface: CLI
  • Version: v1.0.12
  • Extensions enabled: developer, fetch, github, stripe
  • Provider & Model: [e.g. Google - gemini-1.5-pro]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

p1Priority 1 - High (supports roadmap)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions