{"record":{"id":"079bc8a89968648a","repo":"earendil-works/pi","slug":"session-locked-079bc8","errorCode":"session_locked","errorMessage":"Session already exists","messagePattern":"Session already exists","errorType":"error_code","errorClass":"PiServerError","httpStatus":null,"severity":"error","filePath":"packages/server/src/testing/service.ts","lineNumber":227,"sourceCode":"\t\t\tdelay.entered.resolve(undefined);\n\t\t\tawait delay.release.promise;\n\t\t}\n\t\treturn [...this.sessions.values()].map(({ snapshot }) => ({\n\t\t\tid: snapshot.id,\n\t\t\tcreatedAt: snapshot.createdAt,\n\t\t\tupdatedAt: snapshot.updatedAt,\n\t\t\tsessionName: snapshot.name,\n\t\t\tcwd: snapshot.cwd,\n\t\t}));\n\t}\n\n\tasync listModels(): Promise<ModelMetadata[]> {\n\t\treturn [TEST_MODEL];\n\t}\n\n\tasync createSession(options: CreateSessionOptions): Promise<PiSessionRuntime> {\n\t\tthis.lastCreatedId = options.id;\n\t\tif (this.sessions.has(options.id)) throw new PiServerError(\"session_locked\", \"Session already exists\");\n\t\tthis.seed(options.id, options.name, options.cwd, options.model, options.thinkingLevel);\n\t\treturn this.acquire(options.id);\n\t}\n\n\tasync openSession(sessionId: string): Promise<PiSessionRuntime> {\n\t\tif (!this.sessions.has(sessionId)) throw new PiServerError(\"not_found\", `Unknown session: ${sessionId}`);\n\t\tif (this.locked.has(sessionId)) throw new PiServerError(\"session_locked\", `Session is locked: ${sessionId}`);\n\t\treturn this.acquire(sessionId);\n\t}\n\n\tseed(\n\t\tid = \"session-1\",\n\t\tname = `Session ${id}`,\n\t\tcwd = \"/tmp/pi-server-conformance\",\n\t\tmodel: ModelRef = { provider: TEST_MODEL.provider, id: TEST_MODEL.id },\n\t\tthinkingLevel: ThinkingLevel = \"off\",\n\t): void {\n\t\tthis.sessions.set(id, {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/server/src/testing/service.ts#L209-L245","documentation":"Error \"Session already exists\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/server/src/testing/service.ts:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a new session id; the given session already exists."],"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"}