{"record":{"id":"cb185f6d2771921d","repo":"langchain-ai/langgraph","slug":"protocol-command-did-not-return-a-valid-response","errorCode":null,"errorMessage":"Protocol command did not return a valid response.","messagePattern":"Protocol command did not return a valid response\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/sdk-py/langgraph_sdk/stream/transport/http.py","lineNumber":85,"sourceCode":"        Raises:\n            httpx.HTTPStatusError: server returned >= 400.\n            RuntimeError: the transport has been closed via `close()`.\n            RuntimeError: server returned a response missing the protocol envelope.\n        \"\"\"\n        if self._closed:\n            raise RuntimeError(\"Protocol transport is closed.\")\n        # Merge default headers first so content-type always wins.\n        merged_headers = {**self._default_headers, \"content-type\": \"application/json\"}\n        response = await self._client.post(\n            self._commands_url,\n            content=orjson.dumps(command),\n            headers=merged_headers,\n        )\n        response.raise_for_status()\n        if response.status_code in (202, 204):\n            return None\n        if not response.content:\n            raise RuntimeError(\"Protocol command did not return a valid response.\")\n        try:\n            payload = orjson.loads(response.content)\n        except orjson.JSONDecodeError as err:\n            raise RuntimeError(\n                \"Protocol command did not return a valid response.\"\n            ) from err\n        if not isinstance(payload, dict) or \"id\" not in payload:\n            raise RuntimeError(\"Protocol command did not return a valid response.\")\n        return payload\n\n    def open_event_stream(self, params: dict[str, Any]) -> EventStreamHandle:\n        \"\"\"Open an independent filtered SSE event stream.\n\n        Posts `params` as a SubscribeParams body to `/threads/{thread_id}/stream/events`.\n        Returns an `EventStreamHandle` whose `events` async iterator yields typed\n        `Event` dicts as the server emits them. `handle.ready` resolves on a 2xx\n        response (rejects on HTTP error or transport failure before headers).\n","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/sdk-py/langgraph_sdk/stream/transport/http.py#L67-L103","documentation":"Protocol-envelope check in the async HTTP transport: the POST to the commands endpoint returned 2xx, but the response body could not be parsed into the expected JSON envelope (missing or malformed response object). The server replied with something the transport cannot interpret as a protocol response.","triggerScenarios":"Thrown at libs/sdk-py/langgraph_sdk/stream/transport/http.py:85 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the server is a LangGraph server version that supports the v3 thread-centric streaming protocol","Inspect the raw response body (use verbose/debug logging) to see what the server actually returned","Verify the commands URL/path is correct and not hitting a proxy or error page"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","contentChangedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}