Stirling-Tools/Stirling-PDF · error · Error
Stream ended without a result
Error message
Stream ended without a result
What it means
Thrown after consumeSSEStream completes without ever invoking the onResult handler (receivedResult stayed false). This means the SSE stream closed normally but no terminal result event was emitted by the engine — the stream ended prematurely or only emitted progress/error events without a final result.
Source
Thrown at frontend/editor/src/proprietary/components/chat/ChatContext.tsx:705
}
},
onError: (data) => {
receivedResult = true;
dispatch({ type: "SET_PROGRESS", progress: null });
dispatch({
type: "ADD_MESSAGE",
message: {
id: generateId(),
role: ChatRole.ASSISTANT,
content: data.message || "Something went wrong.",
timestamp: Date.now(),
},
});
},
});
if (!receivedResult) {
throw new Error("Stream ended without a result");
}
} catch (e) {
if ((e as Error).name === "AbortError") return;
const err = e as Error;
const isEngineError =
err.message.startsWith("AI engine request failed:") ||
err.message === "Stream ended without a result";
const content = isEngineError
? "Failed to get a response. The AI engine may not be available yet."
: (err.message ??
"Failed to get a response. The AI engine may not be available yet.");
dispatch({ type: "SET_PROGRESS", progress: null });
dispatch({
type: "ADD_MESSAGE",
message: {
id: generateId(),
role: ChatRole.ASSISTANT,
content,View on GitHub (pinned to 9ef20dcab8)
Solutions
- Increase proxy/server read timeouts for the streaming endpoint (nginx proxy_read_timeout, gateway timeout).
- Check AI engine logs for mid-run crashes or unhandled exceptions.
- Verify the engine always emits a terminal result or error event before closing the stream.
- Add a client-side timeout/watchdog that surfaces a clearer message if no result arrives within N seconds.
Defensive patterns
Strategy: validation
Validate before calling
// Add a watchdog that surfaces a clear error if no result arrives in time
const watchdog = setTimeout(() => {
if (!receivedResult) controller.abort();
}, STREAM_TIMEOUT_MS); Try / catch
// Distinguish premature stream close from an explicit error event
if (!receivedResult) {
throw new Error("Stream ended without a result");
} Prevention
- Configure proxy/server timeouts long enough for inference (disable buffering, raise read timeout).
- Ensure the engine always emits a terminal result or error event.
- Add a client-side watchdog so a silent close becomes an actionable timeout.
When it happens
Trigger: The AI engine stream closed mid-run (connection dropped, server timeout, incomplete orchestration) without sending a result event. The onError handler may have fired (which sets receivedResult=true), but if only progress events arrived and the stream closed, receivedResult remains false.
Common situations: The AI engine crashed mid-inference. A proxy/load-balancer cut the long-running SSE connection on a timeout (e.g. nginx proxy_read_timeout). The engine emitted a partial stream then closed without a terminal event.
Related errors
- Response body is null
- detail ?? `AI engine request failed: ${response.status}`
- Login request timed out. Please check your network connectio
- OCR service error: ${title}
- Response is not a valid PDF. Header: "${head}"
AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13).
Data as JSON: /api/errors/5867923a1ed6946a.
Report an issue: GitHub.