{"record":{"id":"38c26e64c740766e","repo":"langchain-ai/langgraph","slug":"protocol-error-code-message","errorCode":null,"errorMessage":"Protocol error [{code}]: {message}","messagePattern":"Protocol error \\[(.+?)\\]: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/sdk-py/langgraph_sdk/_async/stream.py","lineNumber":1801,"sourceCode":"\n        Returns `{}` for 202/204 responses (no body). Raises `RuntimeError`\n        with the protocol code/message when the server returns an error\n        envelope (`{\"type\": \"error\", ...}`).\n        \"\"\"\n        if self._transport is None:\n            raise RuntimeError(\"AsyncThreadStream not entered — use `async with`.\")\n        command_id = self._next_command_id\n        self._next_command_id += 1\n        response = await self._transport.send_command(\n            {\"id\": command_id, \"method\": method, \"params\": params}\n        )\n        if response is None:\n            # 202/204 — no body. Caller gets an empty result.\n            return {}\n        if response.get(\"type\") == \"error\":\n            code = response.get(\"error\", \"unknown\")\n            message = response.get(\"message\", \"\")\n            raise RuntimeError(f\"Protocol error [{code}]: {message}\")\n        meta = response.get(\"meta\")\n        if isinstance(meta, dict):\n            applied_through_seq = meta.get(\"applied_through_seq\")\n            if self._controller is not None:\n                self._controller.observe_applied_through_seq(applied_through_seq)\n        return response.get(\"result\", {})\n\n    async def _await_run_start_gate(self, *, timeout: float | None = None) -> None:\n        \"\"\"Wait for the current run.start to commit the thread server-side.\n\n        No-op when no run.start is in flight. Re-raises if run.start failed.\n        Raises `asyncio.TimeoutError` if `timeout` is set and the gate does\n        not resolve in time; the gate itself is left intact for later callers.\n        \"\"\"\n        gate = self._run_start_ready\n        if gate is None or gate.done():\n            return\n        if timeout is None:","sourceCodeStart":1783,"sourceCodeEnd":1819,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/sdk-py/langgraph_sdk/_async/stream.py#L1783-L1819","documentation":"Error \"Protocol error [{code}]: {message}\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/sdk-py/langgraph_sdk/_async/stream.py:1801 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}