{"record":{"id":"24cbd02a1bae4ca8","repo":"earendil-works/pi","slug":"invalid-entry-24cbd0","errorCode":"invalid_entry","errorMessage":"Invalid SQLite session entry ${row.id}: failed to decode entry ${row.id}","messagePattern":"Invalid SQLite session entry (.+?): failed to decode entry (.+?)","errorType":"exception","errorClass":"SessionError","httpStatus":null,"severity":"error","filePath":"packages/session-backends/sqlite-node/src/sqlite/storage/branch-entries.ts","lineNumber":125,"sourceCode":"\tcustomType: string | null,\n) {\n\tsql`INSERT INTO branch_entries\n\t\t\t(session_id, branch_id, entry_id, entry_seq, entry_type, custom_type)\n\t\t\tVALUES (${sessionId}, ${branchId}, ${entryId}, ${entrySeq}, ${entryType}, ${customType})`.run(db);\n}\n\nfunction customTypeFromPayload(row: BranchPathEntryRow): string | null {\n\tif (row.type !== \"custom\") return null;\n\ttry {\n\t\tconst payload = JSON.parse(row.payload) as unknown;\n\t\tif (typeof payload !== \"object\" || payload === null || Array.isArray(payload)) {\n\t\t\tthrow new Error(\"Payload is not an object\");\n\t\t}\n\t\tconst customType = (payload as { customType?: unknown }).customType;\n\t\tif (typeof customType !== \"string\") throw new Error(\"Invalid custom payload\");\n\t\treturn customType;\n\t} catch (error) {\n\t\tthrow new SessionError(\n\t\t\t\"invalid_entry\",\n\t\t\t`Invalid SQLite session entry ${row.id}: failed to decode entry ${row.id}`,\n\t\t\terror instanceof Error ? error : undefined,\n\t\t);\n\t}\n}\n\nexport function insertBranchEntriesForPath(db: SqliteDatabase, sessionId: string, branchId: string, leafId: string) {\n\tconst path: BranchPathEntryRow[] = [];\n\tconst seen = new Set<string>();\n\tlet entryId: string | null = leafId;\n\n\twhile (entryId !== null) {\n\t\tif (seen.has(entryId)) throw new SessionError(\"invalid_entry\", `Entry parent cycle at ${entryId}`);\n\t\tseen.add(entryId);\n\t\tconst row: BranchPathEntryRow | undefined = sql`SELECT id, seq, parent_id, type, payload\n\t\t\tFROM entries\n\t\t\tWHERE session_id = ${sessionId} AND id = ${entryId}`.get<BranchPathEntryRow>(db);","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/session-backends/sqlite-node/src/sqlite/storage/branch-entries.ts#L107-L143","documentation":"Error \"Invalid SQLite session entry ${row.id}: failed to decode entry ${row.id}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/session-backends/sqlite-node/src/sqlite/storage/branch-entries.ts:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The branch entry failed to decode; check database integrity for that entry."],"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"}