ruvnet / ruvnet/ruflo

v2.0.0-alpha.78 API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.8: `tool_use` ids were found without `tool_result` blocks immediately after

Open
#538 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
72.7k
Forks
8.6k
Avg merge
2d 23h
Merged PRs (30d)
83

Description

Using a SPARC TDD Swarm against sonnet-4 (with no model change during session), the following errors are occuring. This is a similar message to https://github.com/ruvnet/claude-flow/issues/69, but does't appear to have anything to do with model switchover.

```
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.8: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_0158ez84uEEtBCtdwCS3wzQP. Each `tool_use` block must have a corresponding `tool_result` block in the next message."}}
```

My swarm status looks like this just before providing the prompt that creates the error. It is not a transient error, and persists if the prompt is retried.

```
● 🐝 SPARC TDD Swarm Successfully Launched!

πŸ—οΈ Swarm Configuration:
β”œβ”€β”€ ID: swarm_1753894033783_ks55rn9ql
β”œβ”€β”€ Topology: Hierarchical (specialized coordination)
β”œβ”€β”€ Agents: 5/5 active
└── Strategy: Parallel execution

πŸ‘₯ Agent Roster:
β”œβ”€β”€ 🎯 SPARC Orchestrator (Coordinator)
β”œβ”€β”€ πŸ“‹ Specification Agent (Researcher)
β”œβ”€β”€ πŸ›οΈ Architecture Agent (Analyst)
β”œβ”€β”€ πŸ’» Implementation Agent (Coder)
└── ⚑ Refinement Agent (Optimizer)

πŸ”„ SPARC TDD Workflow Ready:
β”œβ”€β”€ S: Specification β†’ Requirements & User Stories
β”œβ”€β”€ P: Pseudocode β†’ Algorithm Design
β”œβ”€β”€ A: Architecture β†’ System Design
β”œβ”€β”€ R: Refinement β†’ Test-Driven Implementation
└── C: Completion β†’ Quality Assurance

The swarm is now ready for systematic TDD using the SPARC methodology. Each agent specializes in different phases:

- Specification Agent: Analyzes requirements and creates user stories
- Architecture Agent: Designs system components and integration points
- Implementation Agent: Follows Red-Green-Refactor TDD cycles
- Refinement Agent: Optimizes code quality and performance
- SPARC Orchestrator: Coordinates the entire workflow
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the SPARC TDD Swarm failure with sonnet-4 and inspect the generated request around messages.8, especially the tool_use and tool_result sequence. Trace how the swarm builds and forwards those messages; done means the prompt succeeds without the invalid_request_error and every tool_use is immediately followed by its corresponding tool_result.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.