{"record":{"id":"cc879ddc8e0da983","repo":"earendil-works/pi","slug":"invalid-request","errorCode":"invalid_request","errorMessage":"Service returned session ${snapshot.id} for server-assigned session ${id}","messagePattern":"Service returned session (.+?) for server-assigned session (.+?)","errorType":"error_code","errorClass":"PiServerError","httpStatus":null,"severity":"error","filePath":"packages/server/src/sessions.ts","lineNumber":219,"sourceCode":"\t\t\ttry {\n\t\t\t\treturn await pending;\n\t\t\t} finally {\n\t\t\t\tif (this.openingSessions.get(id) === pending) this.openingSessions.delete(id);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async create(id: string, acquireRuntime: () => Promise<PiSessionRuntime>): Promise<LiveSession> {\n\t\tconst runtime = await acquireRuntime();\n\t\tif (this.options.isClosing()) {\n\t\t\tawait runtime.dispose();\n\t\t\tthrow new Error(\"PiServer closed while acquiring a session runtime\");\n\t\t}\n\t\tlet live: LiveSession | undefined;\n\t\ttry {\n\t\t\tconst snapshot = await runtime.snapshot();\n\t\t\tif (snapshot.id !== id) {\n\t\t\t\tthrow new PiServerError(\n\t\t\t\t\t\"invalid_request\",\n\t\t\t\t\t`Service returned session ${snapshot.id} for server-assigned session ${id}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlive = {\n\t\t\t\tid,\n\t\t\t\truntime,\n\t\t\t\tconnections: new Set(),\n\t\t\t\tunsubscribe: () => {},\n\t\t\t\toperationCount: 0,\n\t\t\t\tready: false,\n\t\t\t\tterminal: false,\n\t\t\t};\n\t\t\tlive.unsubscribe = runtime.subscribe((event) => this.handleRuntimeEvent(live!, event));\n\t\t\tthis.liveSessions.set(id, live);\n\t\t\tlive.ready = true;\n\t\t\treturn live;\n\t\t} catch (error) {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/server/src/sessions.ts#L201-L237","documentation":"Error \"Service returned session ${snapshot.id} for server-assigned session ${id}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/server/src/sessions.ts:219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The service must return the server-assigned session id; fix the service to honor the requested id."],"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"}