NousResearch/hermes-agent · error · EmptyStreamError
Provider returned an empty stream with no stop_reason (possi
Error message
Provider returned an empty stream with no stop_reason (possible upstream error or malformed event stream).
What it means
Error "Provider returned an empty stream with no stop_reason (possible upstream error or malformed event stream)." thrown in NousResearch/hermes-agent.
Source
Thrown at agent/chat_completion_helpers.py:4051
before the drop it additionally rides the bounded stream-retry
the eventless case uses (probe-verified recovery), while a
drop after streamed preamble text degrades to the
partial-stream-stub/continuation path instead — still never an
empty-args execution.
"""
if getattr(message, "stop_reason", None) is not None:
return False
for block in getattr(message, "content", None) or []:
if getattr(block, "type", None) == "tool_use":
return True
return False
if (
base_final_message is not None
and not getattr(base_final_message, "content", None)
and getattr(base_final_message, "stop_reason", None) is None
):
raise EmptyStreamError(
"Provider returned an empty stream with no stop_reason "
"(possible upstream error or malformed event stream)."
)
if base_final_message is not None and not stream.output_modified:
if _tool_use_dropped_mid_stream(base_final_message):
raise EmptyStreamError(
"Stream ended with no stop_reason while a tool_use "
"block was still incomplete; treating as a "
"mid-tool-call stream drop (#80498)."
)
return base_final_message
final_message = accumulator.response(base_final_message)
if (
not getattr(final_message, "content", None)
and getattr(final_message, "stop_reason", None) is None
):
raise EmptyStreamError(
"Provider returned an empty stream with no stop_reason "View on GitHub (pinned to c896c09c42)
Solutions
- Retry the call; the stream ended without a stop_reason, typically an upstream error.
- Reduce request size or max_tokens if the provider truncates the stream.
- Check provider logs/status for malformed streaming responses.
When it happens
Trigger: Thrown at agent/chat_completion_helpers.py:4051 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/be195cdd96d93286.
Report an issue: GitHub.