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.
Source
Thrown at crates/language_model/src/language_model.rs:301
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);
}
_ => {}
}
}
// Stream ended without a complete tool use
Err(LanguageModelCompletionError::Other(anyhow::anyhow!(
"Stream ended without receiving a complete tool use"
)))
}
.boxed()
}
#[cfg(any(test, feature = "test-support"))]
fn as_fake(&self) -> &fake_provider::FakeLanguageModel {
unimplemented!()
}
}
impl std::fmt::Debug for dyn LanguageModel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("<dyn LanguageModel>")
.field("id", &self.id())
.field("name", &self.name())
.field("provider_id", &self.provider_id())View on GitHub (pinned to f4178619ac)
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@f4178619ac (2026-08-20).
Data as JSON: /api/errors/f3a63c6fc4bef06c.
Report an issue: GitHub.