{"record":{"id":"5b569569c9c95eee","repo":"langchain-ai/langgraph","slug":"asyncthreadstream-not-entered-use-async-with","errorCode":null,"errorMessage":"AsyncThreadStream not entered — use `async with`.","messagePattern":"AsyncThreadStream not entered — use `async with`\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/sdk-py/langgraph_sdk/_async/stream.py","lineNumber":358,"sourceCode":"class _ValuesProjection:\n    \"\"\"Typed projection for `thread.values` — yields state snapshots as they arrive.\n\n    Supports both `async for` (live stream of state snapshots) and `await`\n    (delegates to `thread.output` for the terminal state value).\n    \"\"\"\n\n    def __init__(self, thread: AsyncThreadStream) -> None:\n        self._thread = thread\n\n    def __await__(self) -> Generator[Any, None, Any]:\n        return self._thread.output.__await__()\n\n    def __aiter__(self) -> AsyncIterator[Any]:\n        return self._values_iter()\n\n    async def _values_iter(self) -> AsyncGenerator[Any, None]:\n        if self._thread._transport is None:\n            raise RuntimeError(\"AsyncThreadStream not entered — use `async with`.\")\n        params: SubscribeParams = {\"channels\": [\"values\"]}\n        sub = self._thread._register_subscription(params)\n        decoder = DataDecoder(\"values\")\n        try:\n            await self._thread._reconcile_stream(params)\n            self._thread._ensure_fanout_running()\n            state = await self._thread._fetch_state()\n            yield state[\"values\"]\n            while True:\n                item = await sub.queue.get()\n                if item is None:\n                    return\n                for out in decoder.feed(item):\n                    yield out\n        finally:\n            self._thread._unregister_subscription(sub.id)\n\n","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/sdk-py/langgraph_sdk/_async/stream.py#L340-L376","documentation":"Error \"AsyncThreadStream not entered — use `async with`.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/sdk-py/langgraph_sdk/_async/stream.py:358 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"}