{"record":{"id":"0a963c06a4688eae","repo":"python/cpython","slug":"runner-is-closed","errorCode":null,"errorMessage":"Runner is closed","messagePattern":"Runner is closed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Lib/asyncio/runners.py","lineNumber":143,"sourceCode":"\n        self._interrupt_count = 0\n        try:\n            return self._loop.run_until_complete(task)\n        except exceptions.CancelledError:\n            if self._interrupt_count > 0:\n                uncancel = getattr(task, \"uncancel\", None)\n                if uncancel is not None and uncancel() == 0:\n                    raise KeyboardInterrupt()\n            raise  # CancelledError\n        finally:\n            if (sigint_handler is not None\n                and signal.getsignal(signal.SIGINT) is sigint_handler\n            ):\n                signal.signal(signal.SIGINT, signal.default_int_handler)\n\n    def _lazy_init(self):\n        if self._state is _State.CLOSED:\n            raise RuntimeError(\"Runner is closed\")\n        if self._state is _State.INITIALIZED:\n            return\n        if self._loop_factory is None:\n            self._loop = events.new_event_loop()\n            if not self._set_event_loop:\n                # Call set_event_loop only once to avoid calling\n                # attach_loop multiple times on child watchers\n                events.set_event_loop(self._loop)\n                self._set_event_loop = True\n        else:\n            self._loop = self._loop_factory()\n        if self._debug is not None:\n            self._loop.set_debug(self._debug)\n        self._context = contextvars.copy_context()\n        self._state = _State.INITIALIZED\n\n    def _on_sigint(self, signum, frame, main_task):\n        self._interrupt_count += 1","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/python/cpython/blob/bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6/Lib/asyncio/runners.py#L125-L161","documentation":"Error \"Runner is closed\" thrown in python/cpython.","triggerScenarios":"Raised when an operation is attempted on a Runner that has been closed.","commonSituations":"See trigger scenarios.","solutions":["Do not use the Runner after calling runner.close(); create a new asyncio.Runner() for further runs."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6","analyzedAt":"2026-08-14T22:01:13.976Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}