earendil-works/pi · error · SessionError

invalid_entry

invalid_entry

Error message

Invalid SQLite session entry ${row.id}: failed to decode entry ${row.id}

What it means

Error "Invalid SQLite session entry ${row.id}: failed to decode entry ${row.id}" thrown in earendil-works/pi.

Source

Thrown at packages/session-backends/sqlite-node/src/sqlite/storage/branch-entries.ts:125

	customType: string | null,
) {
	sql`INSERT INTO branch_entries
			(session_id, branch_id, entry_id, entry_seq, entry_type, custom_type)
			VALUES (${sessionId}, ${branchId}, ${entryId}, ${entrySeq}, ${entryType}, ${customType})`.run(db);
}

function customTypeFromPayload(row: BranchPathEntryRow): string | null {
	if (row.type !== "custom") return null;
	try {
		const payload = JSON.parse(row.payload) as unknown;
		if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
			throw new Error("Payload is not an object");
		}
		const customType = (payload as { customType?: unknown }).customType;
		if (typeof customType !== "string") throw new Error("Invalid custom payload");
		return customType;
	} catch (error) {
		throw new SessionError(
			"invalid_entry",
			`Invalid SQLite session entry ${row.id}: failed to decode entry ${row.id}`,
			error instanceof Error ? error : undefined,
		);
	}
}

export function insertBranchEntriesForPath(db: SqliteDatabase, sessionId: string, branchId: string, leafId: string) {
	const path: BranchPathEntryRow[] = [];
	const seen = new Set<string>();
	let entryId: string | null = leafId;

	while (entryId !== null) {
		if (seen.has(entryId)) throw new SessionError("invalid_entry", `Entry parent cycle at ${entryId}`);
		seen.add(entryId);
		const row: BranchPathEntryRow | undefined = sql`SELECT id, seq, parent_id, type, payload
			FROM entries
			WHERE session_id = ${sessionId} AND id = ${entryId}`.get<BranchPathEntryRow>(db);

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. The branch entry failed to decode; check database integrity for that entry.

When it happens

Trigger: Thrown at packages/session-backends/sqlite-node/src/sqlite/storage/branch-entries.ts:125 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/24cbd02a1bae4ca8. Report an issue: GitHub.