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
- 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
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