paperclipai/paperclip · error
${label} are out of order at position ${index}: expected ${s
Error message
${label} are out of order at position ${index}: expected ${sorted[index]}, found ${values[index]} What it means
Error "${label} are out of order at position ${index}: expected ${sorted[index]}, found ${values[index]}" thrown in paperclipai/paperclip.
Source
Thrown at packages/db/src/check-migration-numbering.ts:39
for (const value of values) {
const number = migrationNumber(value);
if (!number) {
throw new Error(`${label} entry does not start with a 4-digit migration number: ${value}`);
}
const existing = seen.get(number);
if (existing) {
throw new Error(`Duplicate migration number ${number} in ${label}: ${existing}, ${value}`);
}
seen.set(number, value);
}
}
function ensureStrictlyOrdered(values: string[], label: string) {
const sorted = [...values].sort();
for (let index = 0; index < values.length; index += 1) {
if (values[index] !== sorted[index]) {
throw new Error(
`${label} are out of order at position ${index}: expected ${sorted[index]}, found ${values[index]}`,
);
}
}
}
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];View on GitHub (pinned to 120ae5428f)
Solutions
- Reorder or renumber the migrations so numbers are strictly increasing.
When it happens
Trigger: Thrown at packages/db/src/check-migration-numbering.ts:39 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/1ae092620ef26b84.
Report an issue: GitHub.