NousResearch/hermes-agent · error · EmptyStreamError
Provider returned an empty stream with no finish_reason (pos
Error message
Provider returned an empty stream with no finish_reason (possible upstream error or malformed SSE response).
What it means
Error "Provider returned an empty stream with no finish_reason (possible upstream error or malformed SSE response)." thrown in NousResearch/hermes-agent.
Source
Thrown at agent/chat_completion_helpers.py:3770
id=tc["id"],
type=tc["type"],
extra_content=tc.get("extra_content"),
function=SimpleNamespace(
name=tc["function"]["name"],
arguments=arguments,
),
))
# Zero-chunk guard: stream yielded nothing usable — a provider/upstream
# error or malformed SSE, not a legitimate empty completion. Raise so the
# retry machinery handles it instead of fabricating a successful turn.
if (
finish_reason is None
and not content_parts
and not reasoning_parts
and not tool_calls_acc
):
raise EmptyStreamError(
"Provider returned an empty stream with no finish_reason "
"(possible upstream error or malformed SSE response)."
)
# A stream that delivered a tool call but only partial/unparseable
# JSON args splits into two very different cases:
#
# 1. Provider sent finish_reason="length" → a genuine output-cap
# truncation. Boosting max_tokens on retry is the right move.
#
# 2. Provider sent NO finish_reason (the SSE simply stopped after
# the opening "{" with no terminator and no [DONE]) → the
# upstream dropped/stalled the connection mid tool-call. This
# is NOT an output cap — the model never reported hitting one.
# Some dedicated endpoints (e.g. NVIDIA Nemotron Ultra on the
# Nous dedicated endpoint) stall for minutes during large
# tool-arg generation, then close the stream cleanly without a
# finish_reason. Stamping "length" here sends it down theView on GitHub (pinned to c896c09c42)
Solutions
- Retry the request; the provider returned an empty stream, often transient.
- Check provider status and the request parameters (model name, max_tokens).
- Switch models/providers if the endpoint consistently returns empty streams.
When it happens
Trigger: Thrown at agent/chat_completion_helpers.py:3770 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14).
Data as JSON: /api/errors/6031d304e32211a9.
Report an issue: GitHub.