earendil-works/pi · error · SessionError
already_exists
already_exists
Error message
Session already exists: ${id} What it means
Error "Session already exists: ${id}" thrown in earendil-works/pi.
Source
Thrown at packages/agent/src/harness/session/memory.ts:153
kind: "fact",
seq: this.state.nextSequence,
fact: "label",
targetId: id,
label,
});
}
async getStats(): Promise<SessionStats> {
return structuredClone(this.state.getStats());
}
}
export class InMemorySessionRepo implements SessionRepo {
private readonly sessions = new Map<string, InMemorySessionStorage>();
async create(options: SessionCreateOptions = {}): Promise<Session> {
const id = options.id ?? uuidv7();
if (this.sessions.has(id)) throw new SessionError("already_exists", `Session already exists: ${id}`);
const storage = new InMemorySessionStorage({
id,
createdAt: Date.now(),
parentSessionId: options.parentSessionId,
});
this.sessions.set(id, storage);
return new Session(storage);
}
async open(metadata: SessionMetadata): Promise<Session> {
return new Session(this.requireStorage(metadata.id));
}
async list(): Promise<SessionMetadata[]> {
return Promise.all([...this.sessions.values()].map((storage) => storage.getMetadata()));
}
async delete(metadata: SessionMetadata): Promise<void> {View on GitHub (pinned to 4af9d21d3b)
Solutions
- Use a unique session id, or load the existing session instead of creating it.
When it happens
Trigger: Thrown at packages/agent/src/harness/session/memory.ts:153 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/8285db1cf95516ac.
Report an issue: GitHub.