earendil-works/pi · error · SessionError

invalid_entry

invalid_entry

Error message

Branch tip ${parentId} changed during append

What it means

Error "Branch tip ${parentId} changed during append" thrown in earendil-works/pi.

Source

Thrown at packages/session-backends/sqlite-node/src/sqlite/branch-cache.ts:66

			`Failed to build SQLite branch cache at entry ${leafId}`,
			error instanceof Error ? error : undefined,
		);
	}
}

function extendBranch(
	db: SqliteDatabase,
	sessionId: string,
	branchId: string,
	parentId: string,
	entryId: string,
	entrySeq: number,
	entryType: string,
	customType: string | null,
) {
	insertBranchEntry(db, sessionId, branchId, entryId, entrySeq, entryType, customType);
	if (!updateBranchTip(db, sessionId, branchId, parentId, entryId)) {
		throw new SessionError("invalid_entry", `Branch tip ${parentId} changed during append`);
	}
}

export function appendEntryToBranchCache(
	db: SqliteDatabase,
	sessionId: string,
	entryId: string,
	entrySeq: number,
	entryType: string,
	customType: string | null,
	parentId: string | null,
) {
	if (parentId === null) {
		const branchId = uuidv7();
		insertBranchEntry(db, sessionId, branchId, entryId, entrySeq, entryType, customType);
		insertBranchTip(db, sessionId, entryId, branchId);
		return;
	}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. A concurrent append changed the branch tip; retry the append.

When it happens

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

Common situations: See trigger scenarios.


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