earendil-works/pi · error · PiServerError
invalid_request
invalid_request
Error message
Service returned session ${snapshot.id} for server-assigned session ${id} What it means
Error "Service returned session ${snapshot.id} for server-assigned session ${id}" thrown in earendil-works/pi.
Source
Thrown at packages/server/src/sessions.ts:219
try {
return await pending;
} finally {
if (this.openingSessions.get(id) === pending) this.openingSessions.delete(id);
}
}
}
private async create(id: string, acquireRuntime: () => Promise<PiSessionRuntime>): Promise<LiveSession> {
const runtime = await acquireRuntime();
if (this.options.isClosing()) {
await runtime.dispose();
throw new Error("PiServer closed while acquiring a session runtime");
}
let live: LiveSession | undefined;
try {
const snapshot = await runtime.snapshot();
if (snapshot.id !== id) {
throw new PiServerError(
"invalid_request",
`Service returned session ${snapshot.id} for server-assigned session ${id}`,
);
}
live = {
id,
runtime,
connections: new Set(),
unsubscribe: () => {},
operationCount: 0,
ready: false,
terminal: false,
};
live.unsubscribe = runtime.subscribe((event) => this.handleRuntimeEvent(live!, event));
this.liveSessions.set(id, live);
live.ready = true;
return live;
} catch (error) {View on GitHub (pinned to 4af9d21d3b)
Solutions
- The service must return the server-assigned session id; fix the service to honor the requested id.
When it happens
Trigger: Thrown at packages/server/src/sessions.ts:219 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/cc879ddc8e0da983.
Report an issue: GitHub.