abhigyanpatwari/GitNexus · error · Error
LLM returned empty streaming response
Error message
LLM returned empty streaming response
What it means
The SSE stream completed without any content delta: no chunk ever carried choice.delta.content (malformed chunks are silently skipped), so accumulated content is empty. The connection itself succeeded (response.ok), distinguishing this from API errors — the stream just yielded no usable text.
Solutions
- Test the endpoint with a streaming curl (-N) and inspect whether data: chunks contain delta.content
- If the server is non-compliant, fix it or use a compliant endpoint / different provider
- Retry with `--verbose` to see the raw stream the CLI receives
- Check the model is actually granted to the key (some providers stream an error frame instead of text)
Defensive patterns
Strategy: retry
Try / catch
try {
await callLLM(prompt, config, undefined, { onChunk });
} catch (err) {
if (err instanceof Error && err.message === 'LLM returned empty streaming response') {
return callLLM(prompt, config); // retry once — often transient
}
throw err;
} Prevention
- Confirm the gateway emits standard SSE `data:` chunks containing delta.content (curl -N test)
- Retry once on empty streams before escalating — many providers glitch transiently
- Keep gateway/proxy firmware current; malformed SSE often comes from custom proxies
When it happens
Trigger: Provider sends only keep-alive/role chunks or empty deltas; all data lines fail JSON.parse or lack the expected shape; model legitimately produced zero tokens (empty completion); proxy mangling the SSE framing so every chunk is skipped.
Common situations: Non-compliant SSE implementations in self-hosted gateways; finish_reason=length with zero output; authorization-limited models that connect but emit nothing; HTTP/1.1 buffers or middlewares splitting lines incorrectly.
Understand the failure class
Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.
Related errors
- claude CLI returned empty output
- codex CLI returned empty output
- content filter triggered mid-stream. The generated content…
- LLM returned empty response
- --allow-insecure-connection /…
AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20).
Data as JSON: /api/errors/2cb566afff45fab2.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/core/wiki/llm-client.ts:525
const delta = choice?.delta?.content;
if (delta) {
content += delta;
onChunk(content.length);
}
} catch {
// Skip malformed SSE chunks
}
}
}
if (contentFilterTriggered) {
throw new Error(
'content filter triggered mid-stream. The generated content was blocked by content policy. Adjust your prompt and retry.',
);
}
if (!content) {
throw new Error('LLM returned empty streaming response');
}
return { content };
}
View on GitHub (pinned to 52924ef12c)