{"record":{"id":"ad9b03395e934b70","repo":"NousResearch/hermes-agent","slug":"stream-ended-with-no-stop-reason-while-a-tool-use","errorCode":null,"errorMessage":"Stream ended with no stop_reason while a tool_use block was still incomplete; treating as a mid-tool-call stream drop (#80498).","messagePattern":"Stream ended with no stop_reason while a tool_use block was still incomplete; treating as a mid-tool-call stream drop \\(#80498\\)\\.","errorType":"exception","errorClass":"EmptyStreamError","httpStatus":null,"severity":"error","filePath":"agent/chat_completion_helpers.py","lineNumber":4057,"sourceCode":"            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 \"\n                \"(possible upstream error or malformed event stream).\"\n            )\n        if _tool_use_dropped_mid_stream(final_message):\n            raise EmptyStreamError(\n                \"Stream ended with no stop_reason while a tool_use \"\n                \"block was still incomplete; treating as a \"","sourceCodeStart":4039,"sourceCodeEnd":4075,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/chat_completion_helpers.py#L4039-L4075","documentation":"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.","triggerScenarios":"Thrown at agent/chat_completion_helpers.py:4057 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; the stream dropped mid tool-call.","If it recurs, reduce concurrent tool calls or prompt size to avoid truncation.","Check the provider's streaming stability or switch models."],"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"}