paperclipai/paperclip · error
Migration journal/file order mismatch at position ${index}:
Error message
Migration journal/file order mismatch at position ${index}: journal has ${journalFile}, files have ${migrationFile} What it means
Error "Migration journal/file order mismatch at position ${index}: journal has ${journalFile}, files have ${migrationFile}" thrown in paperclipai/paperclip.
Source
Thrown at packages/db/src/check-migration-numbering.ts:59
);
}
}
}
function ensureJournalMatchesFiles(migrationFiles: string[], journalTags: string[]) {
const journalFiles = journalTags.map((tag) => `${tag}.sql`);
if (journalFiles.length !== migrationFiles.length) {
throw new Error(
`Migration journal/file count mismatch: journal has ${journalFiles.length}, files have ${migrationFiles.length}`,
);
}
for (let index = 0; index < migrationFiles.length; index += 1) {
const migrationFile = migrationFiles[index];
const journalFile = journalFiles[index];
if (migrationFile !== journalFile) {
throw new Error(
`Migration journal/file order mismatch at position ${index}: journal has ${journalFile}, files have ${migrationFile}`,
);
}
}
}
async function main() {
const migrationFiles = (await readdir(migrationsDir))
.filter((entry) => entry.endsWith(".sql"))
.sort();
ensureNoDuplicates(migrationFiles, "migration files");
ensureStrictlyOrdered(migrationFiles, "migration files");
const rawJournal = await readFile(journalPath, "utf8");
const journal = JSON.parse(rawJournal) as JournalFile;
const journalTags = (journal.entries ?? [])
.map((entry, index) => {View on GitHub (pinned to 120ae5428f)
Solutions
- Fix the journal entry order/tag to match the migration file at that position.
When it happens
Trigger: Thrown at packages/db/src/check-migration-numbering.ts:59 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/8f5b9c21086277e0.
Report an issue: GitHub.