NousResearch/hermes-agent · error · EmptyStreamError

Stream ended with no stop_reason while a tool_use block was

Error message

Stream ended with no stop_reason while a tool_use block was still incomplete; treating as a mid-tool-call stream drop (#80498).

What it means

Error "Stream ended with no stop_reason while a tool_use block was still incomplete; treating as a mid-tool-call stream drop (#80498)." thrown in NousResearch/hermes-agent.

Source

Thrown at agent/chat_completion_helpers.py:4057

            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 "
                "(possible upstream error or malformed event stream)."
            )
        if _tool_use_dropped_mid_stream(final_message):
            raise EmptyStreamError(
                "Stream ended with no stop_reason while a tool_use "
                "block was still incomplete; treating as a "

View on GitHub (pinned to c896c09c42)

Solutions

  1. Retry the request; the stream dropped mid tool-call.
  2. If it recurs, reduce concurrent tool calls or prompt size to avoid truncation.
  3. Check the provider's streaming stability or switch models.

When it happens

Trigger: Thrown at agent/chat_completion_helpers.py:4057 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/ad9b03395e934b70. Report an issue: GitHub.