{"record":{"id":"8096696ec10d3451","repo":"agentscope-ai/agentscope","slug":"session-session-id-not-found-809669","errorCode":null,"errorMessage":"Session '{session_id}' not found.","messagePattern":"Session '(.+?)' not found\\.","errorType":"exception","errorClass":"LookupError","httpStatus":null,"severity":"warning","filePath":"src/agentscope/app/_service/_chat.py","lineNumber":558,"sourceCode":"        Args:\n            user_id (`str`):\n                Authenticated caller's user id.\n            session_id (`str`):\n                Target session id.\n            agent_id (`str`):\n                Agent that owns the session.\n\n        Raises:\n            LookupError:\n                The session does not exist.\n        \"\"\"\n        session = await self._storage.get_session(\n            user_id,\n            agent_id,\n            session_id,\n        )\n        if session is None:\n            raise LookupError(f\"Session '{session_id}' not found.\")\n\n        if await self._message_bus.is_locked(\n            MessageBusKeys.session_lock(session_id),\n        ):\n            await self._message_bus.publish(\n                MessageBusKeys.session_interrupt_channel(),\n                {\"session_id\": session_id},\n            )\n            return\n\n        await enqueue_run_trigger(\n            self._message_bus,\n            user_id=user_id,\n            session_id=session_id,\n            agent_id=agent_id,\n            kind=MessageBusKeys.WAKEUP_KIND_RESUME,\n            inputs=UserInterruptEvent(reply_id=session.state.reply_id),\n        )","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/_service/_chat.py#L540-L576","documentation":"ChatService.interrupt raises LookupError when storage.get_session(user_id, agent_id, session_id) returns None, i.e. no session matches that triple. Because sessions are scoped per user and agent, a technically existing session id still fails if the user_id or agent_id in the call doesn't match the session's owner.","triggerScenarios":"Calling the session interrupt endpoint with a session_id that doesn't exist, or with a mismatched user_id/agent_id pair (e.g. interrupting another user's session or passing the wrong agent).","commonSituations":"Stale session ids held in a frontend after the session ended and was cleaned up; retrying an interrupt after the run completed and the session was reaped; passing an admin user_id while the session belongs to a regular user; copy-pasting ids across environments.","solutions":["Confirm the session exists via the session list/get endpoint for that exact user and agent before interrupting","Check that user_id and agent_id in the call match the session's owners","Refresh the session id from the current conversation state instead of caching it long-term","Treat LookupError on interrupt as 'nothing to interrupt' and surface a friendly message"],"exampleFix":"# before\nawait chat_service.interrupt(user_id, agent_id, session_id)  # LookupError\n# after\nif await storage.get_session(user_id, agent_id, session_id) is not None:\n    await chat_service.interrupt(user_id, agent_id, session_id)\nelse:\n    logger.info(\"Session already gone; nothing to interrupt\")","handlingStrategy":"try-catch","validationCode":"session = await chat_client.get_session(user_id, agent_id, session_id)\nif session is None:\n    logger.info(\"Session gone; nothing to interrupt\")\n    return\nawait chat_client.interrupt(user_id, agent_id, session_id)","typeGuard":null,"tryCatchPattern":"try:\n    await chat_service.interrupt(user_id, agent_id, session_id)\nexcept LookupError:\n    pass  # session already ended; nothing to interrupt","preventionTips":["Match user_id and agent_id exactly to the session's owners","Expire cached session ids in the client so stale interrupts aren't sent"],"tags":["session","not-found","chat","interrupt"],"backgroundTag":"session-not-found","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}