earendil-works/pi · error · SessionError
already_exists
already_exists
Error message
ID already exists: ${id} What it means
Error "ID already exists: ${id}" thrown in earendil-works/pi.
Source
Thrown at packages/session-backends/sqlite-node/src/sqlite/repo.ts:323
const current = path[index]!;
if (current.parent_id !== previous.id) {
throw new SessionError("invalid_entry", `Entry ${current.parent_id} not found`);
}
}
}
function matchesEntryQuery(entry: Entry, query: EntryQuery): boolean {
return (
(query.type === undefined || entry.type === query.type) &&
(query.customType === undefined || (entry.type === "custom" && entry.customType === query.customType)) &&
(query.cursor === undefined ||
(query.order === "oldestFirst" ? entry.seq > query.cursor.afterSeq : entry.seq < query.cursor.afterSeq))
);
}
function assertUnusedId(db: SqliteDatabase, sessionId: string, id: string): void {
if (idExistsInEntries(db, sessionId, id) || idExistsInRecords(db, sessionId, id)) {
throw new SessionError("already_exists", `ID already exists: ${id}`);
}
}
function requireSessionRow(db: SqliteDatabase, sessionId: string): SessionRow {
const row = readSessionRow(db, sessionId);
if (!row) throw new SessionError("not_found", `Session not found: ${sessionId}`);
return row;
}
class SqliteSessionStorage implements SessionStorage<SqliteSessionMetadata> {
private readonly db: SqliteDatabase;
private readonly metadata: SqliteSessionMetadata;
private readonly lease: WriterLease;
private readonly leaseOptions: ResolvedWriterLeaseOptions;
private readonly onRelease: () => void;
private readonly operations = new SerialOperationQueue();
private heartbeatTimer: ReturnType<typeof setTimeout> | undefined;
private leaseError: SessionError | undefined;View on GitHub (pinned to 4af9d21d3b)
Solutions
- Use a unique id; an entry with this id already exists.
When it happens
Trigger: Thrown at packages/session-backends/sqlite-node/src/sqlite/repo.ts:323 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/3368625ea1b0028c.
Report an issue: GitHub.