earendil-works/pi · error · SessionError
storage
storage
Error message
Invalid SQLite session record at sequence ${row.seq}: failed to decode payload What it means
Error "Invalid SQLite session record at sequence ${row.seq}: failed to decode payload" thrown in earendil-works/pi.
Source
Thrown at packages/session-backends/sqlite-node/src/sqlite/repo.ts:284
}
function recordRunId(record: NewRecord): string | undefined {
return record.type === "operation_started" ? record.id : "runId" in record ? record.runId : undefined;
}
function recordOpKind(record: NewRecord): string | undefined {
return record.type === "operation_started" ? record.intent.kind : undefined;
}
function decodeRecord(row: { seq: number; timestamp: number; payload: string }): LaneRecord {
try {
return {
...(JSON.parse(row.payload) as object),
seq: row.seq,
timestamp: row.timestamp,
} as LaneRecord;
} catch (error) {
throw new SessionError(
"storage",
`Invalid SQLite session record at sequence ${row.seq}: failed to decode payload`,
error instanceof Error ? error : undefined,
);
}
}
function validateCachedBranchRows(rows: readonly CachedBranchEntryRow[], query: BranchBounds & EntryQuery): void {
if (rows.length === 0 || query.type !== undefined || query.customType !== undefined) return;
const path = [...rows].sort((left, right) => left.entry_seq - right.entry_seq);
const shouldIncludeRoot =
query.stopAtId === undefined &&
query.stopAtType === undefined &&
query.cursor === undefined &&
(query.order === "oldestFirst" || query.limit === undefined);
if (shouldIncludeRoot && path[0]?.parent_id !== null) {
throw new SessionError("invalid_entry", `Entry ${path[0]?.parent_id} not found`);
}View on GitHub (pinned to 4af9d21d3b)
Solutions
- The stored payload failed to decode; check for corruption or a schema version mismatch.
When it happens
Trigger: Thrown at packages/session-backends/sqlite-node/src/sqlite/repo.ts:284 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/0ce2c8dc7b3743fb.
Report an issue: GitHub.