{"record":{"id":"23208a1f268a696a","repo":"langchain-ai/langgraph","slug":"cannot-patch-execution-info-before-it-has-been-set","errorCode":null,"errorMessage":"Cannot patch execution_info before it has been set","messagePattern":"Cannot patch execution_info before it has been set","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/runtime.py","lineNumber":270,"sourceCode":"            if other.heartbeat is not _no_op_heartbeat\n            else self.heartbeat,\n            previous=self.previous if other.previous is None else other.previous,\n            execution_info=other.execution_info or self.execution_info,\n            server_info=other.server_info or self.server_info,\n            control=other.control or self.control,\n        )\n\n    def override(\n        self, **overrides: Unpack[_RuntimeOverrides[ContextT]]\n    ) -> Runtime[ContextT]:\n        \"\"\"Replace the runtime with a new runtime with the given overrides.\"\"\"\n        return replace(self, **overrides)\n\n    def patch_execution_info(self, **overrides: Any) -> Runtime[ContextT]:\n        \"\"\"Return a new runtime with selected execution_info fields replaced.\"\"\"\n        if self.execution_info is None:\n            msg = \"Cannot patch execution_info before it has been set\"\n            raise RuntimeError(msg)\n        return replace(\n            self,\n            execution_info=self.execution_info.patch(**overrides),\n        )\n\n    @property\n    def drain_requested(self) -> bool:\n        return self.control.drain_requested if self.control is not None else False\n\n    @property\n    def drain_reason(self) -> str | None:\n        return self.control.drain_reason if self.control is not None else None\n\n\nDEFAULT_RUNTIME = Runtime(\n    context=None,\n    store=None,\n    stream_writer=_no_op_stream_writer,","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/runtime.py#L252-L288","documentation":"Raised by Runtime patching logic when code attempts to patch execution_info before any execution_info has been set on the runtime. There is no prior value to merge or replace, indicating a lifecycle/ordering bug.","triggerScenarios":"Thrown at libs/langgraph/langgraph/runtime.py:270 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set execution_info first via the normal runtime lifecycle before patching","Use the provided runtime override/replace APIs instead of manual patching"],"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"}