{"record":{"id":"0ce2c8dc7b3743fb","repo":"earendil-works/pi","slug":"storage-0ce2c8","errorCode":"storage","errorMessage":"Invalid SQLite session record at sequence ${row.seq}: failed to decode payload","messagePattern":"Invalid SQLite session record at sequence (.+?): failed to decode payload","errorType":"error_code","errorClass":"SessionError","httpStatus":null,"severity":"error","filePath":"packages/session-backends/sqlite-node/src/sqlite/repo.ts","lineNumber":284,"sourceCode":"}\n\nfunction recordRunId(record: NewRecord): string | undefined {\n\treturn record.type === \"operation_started\" ? record.id : \"runId\" in record ? record.runId : undefined;\n}\n\nfunction recordOpKind(record: NewRecord): string | undefined {\n\treturn record.type === \"operation_started\" ? record.intent.kind : undefined;\n}\n\nfunction decodeRecord(row: { seq: number; timestamp: number; payload: string }): LaneRecord {\n\ttry {\n\t\treturn {\n\t\t\t...(JSON.parse(row.payload) as object),\n\t\t\tseq: row.seq,\n\t\t\ttimestamp: row.timestamp,\n\t\t} as LaneRecord;\n\t} catch (error) {\n\t\tthrow new SessionError(\n\t\t\t\"storage\",\n\t\t\t`Invalid SQLite session record at sequence ${row.seq}: failed to decode payload`,\n\t\t\terror instanceof Error ? error : undefined,\n\t\t);\n\t}\n}\n\nfunction validateCachedBranchRows(rows: readonly CachedBranchEntryRow[], query: BranchBounds & EntryQuery): void {\n\tif (rows.length === 0 || query.type !== undefined || query.customType !== undefined) return;\n\tconst path = [...rows].sort((left, right) => left.entry_seq - right.entry_seq);\n\tconst shouldIncludeRoot =\n\t\tquery.stopAtId === undefined &&\n\t\tquery.stopAtType === undefined &&\n\t\tquery.cursor === undefined &&\n\t\t(query.order === \"oldestFirst\" || query.limit === undefined);\n\tif (shouldIncludeRoot && path[0]?.parent_id !== null) {\n\t\tthrow new SessionError(\"invalid_entry\", `Entry ${path[0]?.parent_id} not found`);\n\t}","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/session-backends/sqlite-node/src/sqlite/repo.ts#L266-L302","documentation":"Error \"Invalid SQLite session record at sequence ${row.seq}: failed to decode payload\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/session-backends/sqlite-node/src/sqlite/repo.ts:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The stored payload failed to decode; check for corruption or a schema version mismatch."],"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"}