paperclipai/paperclip · error

${label} entry does not start with a 4-digit migration numbe

Error message

${label} entry does not start with a 4-digit migration number: ${value}

What it means

Error "${label} entry does not start with a 4-digit migration number: ${value}" thrown in paperclipai/paperclip.

Source

Thrown at packages/db/src/check-migration-numbering.ts:25

type JournalFile = {
  entries?: Array<{
    idx?: number;
    tag?: string;
  }>;
};

function migrationNumber(value: string): string | null {
  const match = value.match(/^(\d{4})_/);
  return match ? match[1] : null;
}

function ensureNoDuplicates(values: string[], label: string) {
  const seen = new Map<string, string>();

  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]}`,
      );
    }
  }

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Rename the migration entry so it starts with a 4-digit migration number.

When it happens

Trigger: Thrown at packages/db/src/check-migration-numbering.ts:25 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/eef827aaac39c4e5. Report an issue: GitHub.