{"record":{"id":"a036ad5d914c8ec7","repo":"github/copilot-sdk","slug":"failed-to-delete-session-sessionid-error","errorCode":null,"errorMessage":"Failed to delete session ${sessionId}: ${error || \"Unknown error\"}","messagePattern":"Failed to delete session (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":2297,"sourceCode":"     * @throws Error if the session does not exist or deletion fails\n     *\n     * @example\n     * ```typescript\n     * await client.deleteSession(\"session-123\");\n     * ```\n     */\n    async deleteSession(sessionId: string): Promise<void> {\n        if (!this.connection) {\n            throw new Error(\"Client not connected\");\n        }\n\n        const response = await this.connection.sendRequest(\"session.delete\", {\n            sessionId,\n        });\n\n        const { success, error } = response as { success: boolean; error?: string };\n        if (!success) {\n            throw new Error(`Failed to delete session ${sessionId}: ${error || \"Unknown error\"}`);\n        }\n\n        const session = this.sessions.get(sessionId);\n        this.sessions.delete(sessionId);\n        session?._runOnDisconnected();\n    }\n\n    /**\n     * List all available sessions.\n     *\n     * @param filter - Optional filter to limit returned sessions by context fields\n     *\n     * @example\n     * // List all sessions\n     * const sessions = await client.listSessions();\n     *\n     * @example\n     * // List sessions for a specific repository","sourceCodeStart":2279,"sourceCodeEnd":2315,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L2279-L2315","documentation":"The session.delete RPC completed but returned success: false — the runtime acknowledged the request yet refused/failed to delete the session, and the message embeds the runtime's own error string (or 'Unknown error' when the response carried none). Common causes: the session is still active/foreground, or server-side cleanup failed.","triggerScenarios":"Thrown at nodejs/src/client.ts:2297 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the embedded error string — it comes from the runtime and names the actual failure reason","Disconnect or stop the session before deleting it","Verify the sessionId exists and is not protected (e.g. the foreground session)","Retry once after addressing the reported cause; transient server-side cleanup failures do occur"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}