{"record":{"id":"1d647717894ce34b","repo":"langchain-ai/langgraph","slug":"shutdown","errorCode":null,"errorMessage":"shutdown","messagePattern":"shutdown","errorType":"exception","errorClass":"GraphDrained","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/pregel/main.py","lineNumber":3015,"sourceCode":"                version,\n                _output_mapper,\n                _state_mapper,\n            )\n            # handle exit\n            if loop.status == \"out_of_steps\":\n                msg = create_error_message(\n                    message=(\n                        f\"Recursion limit of {config['recursion_limit']} reached \"\n                        \"without hitting a stop condition. You can increase the \"\n                        \"limit by setting the `recursion_limit` config key.\"\n                    ),\n                    error_code=ErrorCode.GRAPH_RECURSION_LIMIT,\n                )\n                raise GraphRecursionError(msg)\n            elif loop.status == \"draining\":\n                if loop.control is None:\n                    raise RuntimeError(\"Draining status requires run control\")\n                raise GraphDrained(loop.control.drain_reason or \"shutdown\")\n            # set final channel values as run output\n            run_manager.on_chain_end(loop.output)\n        except BaseException as e:\n            if run_manager is not None:\n                run_manager.on_chain_error(e)\n            raise\n\n    @overload\n    def astream(\n        self,\n        input: InputT | Command | None,\n        config: RunnableConfig | None = None,\n        *,\n        context: ContextT | None = None,\n        stream_mode: StreamMode | Sequence[StreamMode] | None = None,\n        print_mode: StreamMode | Sequence[StreamMode] = (),\n        output_keys: str | Sequence[str] | None = None,\n        interrupt_before: All | Sequence[str] | None = None,","sourceCodeStart":2997,"sourceCodeEnd":3033,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/pregel/main.py#L2997-L3033","documentation":"Sentinel error string used in the stream loop's exit handling when the run terminates due to shutdown. It is a generic guard value (not a user-facing validation) indicating the loop was closed by the runtime shutting down.","triggerScenarios":"Thrown at libs/langgraph/langgraph/pregel/main.py:3015 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Handle the shutdown/interrupt at the caller and restart the run from the last checkpoint","Avoid cancelling the run's task if graceful completion is required"],"exampleFix":null,"handlingStrategy":"try-catch","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"}