{"record":{"id":"014611b1c4c4508b","repo":"HKUDS/nanobot","slug":"required-session-is-not-active","errorCode":null,"errorMessage":"required session is not active","messagePattern":"required session is not active","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"nanobot/agent/loop.py","lineNumber":1802,"sourceCode":"        )\n\n    async def _restore_turn(self, ctx: TurnContext) -> None:\n        \"\"\"Restore checkpoint / pending user turn; reference non-image attachments.\"\"\"\n        msg = ctx.msg\n\n        if ctx.kind is TurnKind.USER and msg.media:\n            new_content, image_paths = reference_non_image_attachments(\n                msg.content,\n                msg.media,\n            )\n            ctx.msg = dataclasses.replace(msg, content=new_content, media=image_paths)\n            msg = ctx.msg\n\n        if ctx.session is None:\n            if msg.require_existing_session:\n                ctx.session = self.sessions.get_cached(ctx.session_key)\n                if ctx.session is None:\n                    raise RuntimeError(\"required session is not active\")\n            else:\n                ctx.session = self.sessions.get_or_create(ctx.session_key)\n        session = ctx.session\n        ctx.ephemeral = ctx.ephemeral or not session.policy.persist\n        tools = ctx.tools or self.tools\n        if session.policy.disabled_tools:\n            restricted = ToolRegistry()\n            for name in tools.tool_names:\n                tool = tools.get(name)\n                if name not in session.policy.disabled_tools and tool:\n                    restricted.register(tool)\n            tools = restricted\n        ctx.tools = tools\n\n        if ctx.kind is TurnKind.SYSTEM:\n            logger.info(\"Processing system message from {}\", msg.sender_id)\n        elif session.policy.log_content:\n            preview = msg.content[:80] + \"...\" if len(msg.content) > 80 else msg.content","sourceCodeStart":1784,"sourceCodeEnd":1820,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/agent/loop.py#L1784-L1820","documentation":"Error \"required session is not active\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/agent/loop.py:1802 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":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}