{"id":"d4714c8cb0d88e13","repo":"drizzle-team/drizzle-orm","slug":"there-are-no-enough-values-to-fill-unique-column","errorCode":null,"errorMessage":"There are no enough values to fill unique column.","messagePattern":"There are no enough values to fill unique column\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/Generators.ts","lineNumber":279,"sourceCode":"\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\n\t\tlet { maxRepeatedValuesCount } = this;\n\t\tconst { params, isUnique, notNull, weightedCountSeed } = this;\n\n\t\tconst values = params.values;\n\n\t\tlet valuesWeightedIndices;\n\t\tif (isObject(values[0])) {\n\t\t\tvaluesWeightedIndices = getWeightedIndices((values as { weight: number }[]).map((val) => val.weight));\n\t\t\tif (isUnique === true && notNull === true) {\n\t\t\t\tlet idx: number, valueIdx: number, rng = prand.xoroshiro128plus(seed);","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/Generators.ts#L261-L297","documentation":"Error \"There are no enough values to fill unique column.\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"Requesting more rows than the pool of available unique values for a unique column generator.","commonSituations":"valuesFromArray with fewer entries than the requested count on a unique column; narrow unique ranges.","solutions":["Increase the number of available values, reduce the requested row count, or drop the unique constraint so values can repeat."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}