zed-industries/zed · error · LanguageModelCompletionError
Stream ended without receiving a complete tool use
Error message
Stream ended without receiving a complete tool use
What it means
Raised in stream_completion_tool after draining the entire completion event stream: no event carried a ToolUse with is_input_complete (complete tool inputs), yet the caller expected the model to invoke a tool. The model ended its turn with plain text, a stop, or an incomplete tool use instead of delivering a finished tool call, so the tool-use contract of the request was violated.
Solutions
- Retry the request — models occasionally omit the expected tool call
- Check that the request actually requires a tool (tool_choice forced) and the tools are correctly advertised
- Inspect the stream events for incomplete ToolUse chunks or a Stop reason explaining the early end
- Reduce prompt complexity or max_tokens constraints that may end the turn before the tool call completes
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/language_model/src/language_model.rs:301 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20).
Data as JSON: /api/errors/f3a63c6fc4bef06c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/language_model/src/language_model.rs:337
}
}))
.boxed();
Ok(LanguageModelTextStream {
message_id,
stream,
last_token_usage,
})
}
.boxed()
}
fn stream_completion_tool(
&self,
request: LanguageModelRequest,
cx: &AsyncApp,
) -> BoxFuture<'static, Result<LanguageModelToolUse, LanguageModelCompletionError>> {
let future = self.stream_completion(request, cx);
async move {
let events = future.await?;
let mut events = events.fuse();
// Iterate through events until we find a complete ToolUse
while let Some(event) = events.next().await {
match event {
Ok(LanguageModelCompletionEvent::ToolUse(tool_use))
if tool_use.is_input_complete =>
{
return Ok(tool_use);
}
Err(err) => {
return Err(err);
}
_ => {}
}View on GitHub (pinned to 916fc2b8cb)