{"record":{"id":"be195cdd96d93286","repo":"NousResearch/hermes-agent","slug":"provider-returned-an-empty-stream-with-no-stop-rea","errorCode":null,"errorMessage":"Provider returned an empty stream with no stop_reason (possible upstream error or malformed event stream).","messagePattern":"Provider returned an empty stream with no stop_reason \\(possible upstream error or malformed event stream\\)\\.","errorType":"exception","errorClass":"EmptyStreamError","httpStatus":null,"severity":"error","filePath":"agent/chat_completion_helpers.py","lineNumber":4051,"sourceCode":"            before the drop it additionally rides the bounded stream-retry\n            the eventless case uses (probe-verified recovery), while a\n            drop after streamed preamble text degrades to the\n            partial-stream-stub/continuation path instead — still never an\n            empty-args execution.\n            \"\"\"\n            if getattr(message, \"stop_reason\", None) is not None:\n                return False\n            for block in getattr(message, \"content\", None) or []:\n                if getattr(block, \"type\", None) == \"tool_use\":\n                    return True\n            return False\n\n        if (\n            base_final_message is not None\n            and not getattr(base_final_message, \"content\", None)\n            and getattr(base_final_message, \"stop_reason\", None) is None\n        ):\n            raise EmptyStreamError(\n                \"Provider returned an empty stream with no stop_reason \"\n                \"(possible upstream error or malformed event stream).\"\n            )\n        if base_final_message is not None and not stream.output_modified:\n            if _tool_use_dropped_mid_stream(base_final_message):\n                raise EmptyStreamError(\n                    \"Stream ended with no stop_reason while a tool_use \"\n                    \"block was still incomplete; treating as a \"\n                    \"mid-tool-call stream drop (#80498).\"\n                )\n            return base_final_message\n        final_message = accumulator.response(base_final_message)\n        if (\n            not getattr(final_message, \"content\", None)\n            and getattr(final_message, \"stop_reason\", None) is None\n        ):\n            raise EmptyStreamError(\n                \"Provider returned an empty stream with no stop_reason \"","sourceCodeStart":4033,"sourceCodeEnd":4069,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/chat_completion_helpers.py#L4033-L4069","documentation":"Error \"Provider returned an empty stream with no stop_reason (possible upstream error or malformed event stream).\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at agent/chat_completion_helpers.py:4051 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}