{"id":"fe549785798ced1d","repo":"drizzle-team/drizzle-orm","slug":"can-t-be-greater-than-1-if-column-is-unique","errorCode":null,"errorMessage":"Can't be greater than 1 if column is unique.","messagePattern":"Can't be greater than 1 if column is unique\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/Generators.ts","lineNumber":269,"sourceCode":"\t\t\t\t|| (isObject(values[0]) && typeof maxRepeatedValuesCount === 'number'\n\t\t\t\t\t&& maxRepeatedValuesCount * allValuesCount < count)\n\t\t\t)\n\t\t) {\n\t\t\tthrow new Error(\"Can't fill notNull column with null values.\");\n\t\t}\n\n\t\tif (\n\t\t\tisUnique === true && maxRepeatedValuesCount !== undefined && (\n\t\t\t\t(typeof maxRepeatedValuesCount === 'number' && maxRepeatedValuesCount > 1)\n\t\t\t\t|| (typeof maxRepeatedValuesCount === 'object' && !maxRepeatedValuesCount\n\t\t\t\t\t.every((obj) =>\n\t\t\t\t\t\t(typeof obj.count) === 'number'\n\t\t\t\t\t\t\t? obj.count === 1\n\t\t\t\t\t\t\t: (obj.count as number[]).every((count) => count === 1)\n\t\t\t\t\t))\n\t\t\t)\n\t\t) {\n\t\t\tthrow new Error(\"Can't be greater than 1 if column is unique.\");\n\t\t}\n\n\t\tif (\n\t\t\tisUnique === true && notNull === true && (\n\t\t\t\t(!isObject(values[0]) && values.length < count)\n\t\t\t\t|| (isObject(values[0]) && allValuesCount < count)\n\t\t\t)\n\t\t) {\n\t\t\t// console.log(maxRepeatedValuesCount, values.length, allValuesCount, count)\n\t\t\tthrow new Error('There are no enough values to fill unique column.');\n\t\t}\n\t}\n\n\toverride init({ count, seed }: { count: number; seed: number }) {\n\t\tsuper.init({ count, seed });\n\n\t\tthis.checks({ count });\n","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/Generators.ts#L251-L287","documentation":"Error \"Can't be greater than 1 if column is unique.\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"Setting a repeat/weight count greater than 1 for a unique column generator.","commonSituations":"Weighted values with weight >1 mapped to a unique column; maxRepeatedValuesCount >1 on unique fields.","solutions":["For unique columns, keep the repeat/probability value at 1 or below, or remove the unique constraint."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}