{"record":{"id":"7f841dd648e569ff","repo":"paperclipai/paperclip","slug":"duplicate-migration-number-number-in-label","errorCode":null,"errorMessage":"Duplicate migration number ${number} in ${label}: ${existing}, ${value}","messagePattern":"Duplicate migration number (.+?) in (.+?): (.+?), (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/db/src/check-migration-numbering.ts","lineNumber":29,"sourceCode":"  }>;\n};\n\nfunction migrationNumber(value: string): string | null {\n  const match = value.match(/^(\\d{4})_/);\n  return match ? match[1] : null;\n}\n\nfunction ensureNoDuplicates(values: string[], label: string) {\n  const seen = new Map<string, string>();\n\n  for (const value of values) {\n    const number = migrationNumber(value);\n    if (!number) {\n      throw new Error(`${label} entry does not start with a 4-digit migration number: ${value}`);\n    }\n    const existing = seen.get(number);\n    if (existing) {\n      throw new Error(`Duplicate migration number ${number} in ${label}: ${existing}, ${value}`);\n    }\n    seen.set(number, value);\n  }\n}\n\nfunction ensureStrictlyOrdered(values: string[], label: string) {\n  const sorted = [...values].sort();\n  for (let index = 0; index < values.length; index += 1) {\n    if (values[index] !== sorted[index]) {\n      throw new Error(\n        `${label} are out of order at position ${index}: expected ${sorted[index]}, found ${values[index]}`,\n      );\n    }\n  }\n}\n\nfunction ensureJournalMatchesFiles(migrationFiles: string[], journalTags: string[]) {\n  const journalFiles = journalTags.map((tag) => `${tag}.sql`);","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/db/src/check-migration-numbering.ts#L11-L47","documentation":"Error \"Duplicate migration number ${number} in ${label}: ${existing}, ${value}\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at packages/db/src/check-migration-numbering.ts:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Renumber one of the duplicate migrations so each number is unique."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}