paperclipai/paperclip · error
Failed to bootstrap migrations: ${bootstrappedState.pendingM
Error message
Failed to bootstrap migrations: ${bootstrappedState.pendingMigrations.join(", ")} What it means
Terminal failure of the migration bootstrap path on an embedded/test database: after running migrations and attempting pending-history reconciliation, some migrations are still recorded as pending (named in the message), so the bootstrap gives up rather than looping.
Source
Thrown at packages/db/src/client.ts:830
const rows = await sql.unsafe<{ id: number }[]>(`SELECT id FROM ${qualifiedTable} ORDER BY id`);
const journalMigrationFiles = await listJournalMigrationFiles();
const appliedFromIds = rows
.map((row) => journalMigrationFiles[row.id - 1])
.filter((name): name is string => Boolean(name));
if (appliedFromIds.length > 0) return appliedFromIds;
return availableMigrations.slice(0, Math.max(0, rows.length));
}
export type MigrationHistoryReconcileResult = {
repairedMigrations: string[];
remainingMigrations: string[];
};
export async function reconcilePendingMigrationHistory(
url: string,
): Promise<MigrationHistoryReconcileResult> {
const state = await inspectMigrations(url);
if (state.status !== "needsMigrations" || state.reason !== "pending-migrations") {
return { repairedMigrations: [], remainingMigrations: [] };
}
const sql = createUtilitySql(url);
const repairedMigrations: string[] = [];
try {
const journalEntries = await listJournalMigrationEntries();
const folderMillisByFile = new Map(journalEntries.map((entry) => [entry.fileName, entry.folderMillis]));
const migrationTableSchema = await discoverMigrationTableSchema(sql);
if (!migrationTableSchema) {
return { repairedMigrations, remainingMigrations: state.pendingMigrations };
}
const columnNames = await getMigrationTableColumnNames(sql, migrationTableSchema);
const qualifiedTable = `${quoteIdentifier(migrationTableSchema)}.${quoteIdentifier(DRIZZLE_MIGRATIONS_TABLE)}`;
View on GitHub (pinned to 01ad858492)
Solutions
- Inspect why the listed migrations failed to bootstrap and fix them.
- Run `pnpm db:migrate` and check migration logs.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at packages/db/src/client.ts:750 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18).
Data as JSON: /api/errors/06a9a2943856aa81.
Report an issue: GitHub.