{"record":{"id":"84a5f107fc21250b","repo":"earendil-works/pi","slug":"session-sessionid-is-not-attached","errorCode":null,"errorMessage":"Session ${sessionId} is not attached","messagePattern":"Session (.+?) is not attached","errorType":"exception","errorClass":"PiSessionDetachedError","httpStatus":null,"severity":"error","filePath":"packages/client/src/client.ts","lineNumber":229,"sourceCode":"\t\tthis.#sessionLeaseGenerations.set(sessionId, generation);\n\t\tlet state: SessionLeaseState = \"active\";\n\t\tlet releasePromise: Promise<void> | undefined;\n\t\tconst refreshState = () => {\n\t\t\tif (\n\t\t\t\t(state === \"active\" || state === \"releasing\") &&\n\t\t\t\tthis.#sessionLeaseGenerations.get(sessionId) !== generation\n\t\t\t) {\n\t\t\t\tstate = \"invalidated\";\n\t\t\t}\n\t\t};\n\t\tconst isActive = () => {\n\t\t\trefreshState();\n\t\t\treturn state === \"active\" && this.#state.isSessionAttached(sessionId);\n\t\t};\n\t\tconst assertActive = () => {\n\t\t\tthis.#assertNotDisposed();\n\t\t\tif (!this.connected) throw new PiDisconnectedError();\n\t\t\tif (!isActive()) throw new PiSessionDetachedError(sessionId);\n\t\t};\n\t\tconst release = (relinquishOnFailure: boolean): Promise<void> => {\n\t\t\trefreshState();\n\t\t\tif (state === \"released\" || state === \"invalidated\") return Promise.resolve();\n\t\t\tif (releasePromise) return releasePromise;\n\t\t\tassertActive();\n\t\t\tstate = \"releasing\";\n\t\t\treleasePromise = (async () => {\n\t\t\t\tconst count = this.#sessionLeaseCounts.get(sessionId) ?? 0;\n\t\t\t\tif (count <= 1) {\n\t\t\t\t\tconst detachment = this.#request({ command: \"detach\", sessionId }).then(() => undefined);\n\t\t\t\t\tthis.#sessionDetachments.set(sessionId, detachment);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait detachment;\n\t\t\t\t\t\tthis.#releaseSessionLease(sessionId, token);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (this.#sessionDetachments.get(sessionId) === detachment) {\n\t\t\t\t\t\t\tthis.#sessionDetachments.delete(sessionId);","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/client/src/client.ts#L211-L247","documentation":"Error \"Session ${sessionId} is not attached\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/client/src/client.ts:229 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Attach the session before operating on it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}