{"record":{"id":"fe2381116d10f291","repo":"earendil-works/pi","slug":"invalid-fork-target-fe2381","errorCode":"invalid_fork_target","errorMessage":"Fork target is not a message entry: ${selectedEntryId}","messagePattern":"Fork target is not a message entry: (.+?)","errorType":"exception","errorClass":"SessionError","httpStatus":null,"severity":"error","filePath":"packages/session-backends/sqlite-node/src/sqlite/repo.ts","lineNumber":824,"sourceCode":"\t\t\tif (sessionExists(db, id)) throw new SessionError(\"already_exists\", `Session already exists: ${id}`);\n\n\t\t\tconst entries: EntryRow[] = [];\n\t\t\tconst lanes: { lane: string; leafId: string | null }[] = [];\n\t\t\tconst branchTips: string[] = [];\n\t\t\tlet branchForkTargetId: string | null = null;\n\n\t\t\tif (options.scope === \"tree\") {\n\t\t\t\tentries.push(...readEntryRows(db, source.id, { order: \"oldestFirst\" }));\n\t\t\t\tlanes.push(...readLanes(db, source.id).map((row) => ({ lane: row.lane, leafId: row.leaf_id })));\n\t\t\t\tbranchTips.push(...readBranchTipIds(db, source.id));\n\t\t\t} else {\n\t\t\t\tconst main = readLane(db, source.id, \"main\");\n\t\t\t\tif (!main) throw new SessionError(\"invalid_lane\", \"Lane not found: main\");\n\t\t\t\tconst selectedEntryId = options.entryId ?? main.leaf_id;\n\t\t\t\tif (selectedEntryId !== null) {\n\t\t\t\t\tconst target = readEntryRow(db, source.id, selectedEntryId);\n\t\t\t\t\tif (!target || target.type !== \"message\") {\n\t\t\t\t\t\tthrow new SessionError(\n\t\t\t\t\t\t\t\"invalid_fork_target\",\n\t\t\t\t\t\t\t`Fork target is not a message entry: ${selectedEntryId}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst position = options.position ?? (options.entryId === undefined ? \"at\" : \"before\");\n\t\t\t\t\tbranchForkTargetId = position === \"at\" ? target.id : target.parent_id;\n\t\t\t\t}\n\t\t\t\tlanes.push({ lane: \"main\", leafId: branchForkTargetId });\n\t\t\t\tif (branchForkTargetId !== null) {\n\t\t\t\t\tconst cached = readCachedBranch(db, source.id, branchForkTargetId);\n\t\t\t\t\tif (!cached) {\n\t\t\t\t\t\tthrow new SessionError(\n\t\t\t\t\t\t\t\"invalid_fork_target\",\n\t\t\t\t\t\t\t`Fork target is not on a cached branch: ${branchForkTargetId}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst rows = queryCachedBranchRows(db, source.id, cached, { order: \"oldestFirst\" });\n\t\t\t\t\tentries.push(...rows.map(entryRowFromCached));","sourceCodeStart":806,"sourceCodeEnd":842,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/session-backends/sqlite-node/src/sqlite/repo.ts#L806-L842","documentation":"Error \"Fork target is not a message entry: ${selectedEntryId}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/session-backends/sqlite-node/src/sqlite/repo.ts:824 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fork from a message entry; the selected entry is not a message."],"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"}