langchain-ai/langgraph · error · RuntimeError

Protocol command did not return a valid response.

Error message

Protocol command did not return a valid response.

What it means

Error "Protocol command did not return a valid response." thrown in langchain-ai/langgraph.

Source

Thrown at libs/sdk-py/langgraph_sdk/stream/transport/ws.py:71

        self._ping_timeout = ping_timeout
        self._closed = False
        self._event_streams: set[asyncio.Task[None]] = set()

    async def send_command(self, command: dict[str, Any]) -> dict[str, Any] | None:
        if self._closed:
            raise RuntimeError("Protocol transport is closed.")
        merged_headers = {**self._default_headers, "content-type": "application/json"}
        response = await self._client.post(
            self._commands_url,
            content=orjson.dumps(command),
            headers=merged_headers,
        )
        response.raise_for_status()
        if response.status_code in (202, 204):
            return None
        payload = orjson.loads(response.content)
        if not isinstance(payload, dict) or "id" not in payload:
            raise RuntimeError("Protocol command did not return a valid response.")
        return payload

    def open_event_stream(self, params: dict[str, Any]) -> EventStreamHandle:
        if self._closed:
            raise RuntimeError("Protocol transport is closed.")

        loop = asyncio.get_running_loop()
        ready: asyncio.Future[None] = loop.create_future()
        done: asyncio.Future[BaseException | None] = loop.create_future()
        queue: asyncio.Queue[Event | None] = asyncio.Queue(maxsize=self._max_queue_size)
        cancel_event = asyncio.Event()
        ws_holder: dict[str, Any] = {"ws": None}

        async def pump() -> None:
            try:
                url = build_websocket_url(self._client.base_url, self._stream_path)
                handshake_headers = list(websocket_headers(self._default_headers))
                cookie_header = _cookie_header(self._client, self._stream_path)

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/sdk-py/langgraph_sdk/stream/transport/ws.py:71 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26). Data as JSON: /api/errors/d3987d3f97bd181c. Report an issue: GitHub.