drizzle-team/drizzle-orm · error · Error
There are no enough values to fill unique column.
Error message
There are no enough values to fill unique column.
What it means
Error "There are no enough values to fill unique column." thrown in drizzle-team/drizzle-orm.
Source
Thrown at drizzle-seed/src/services/Generators.ts:279
|| (typeof maxRepeatedValuesCount === 'object' && !maxRepeatedValuesCount
.every((obj) =>
(typeof obj.count) === 'number'
? obj.count === 1
: (obj.count as number[]).every((count) => count === 1)
))
)
) {
throw new Error("Can't be greater than 1 if column is unique.");
}
if (
isUnique === true && notNull === true && (
(!isObject(values[0]) && values.length < count)
|| (isObject(values[0]) && allValuesCount < count)
)
) {
// console.log(maxRepeatedValuesCount, values.length, allValuesCount, count)
throw new Error('There are no enough values to fill unique column.');
}
}
override init({ count, seed }: { count: number; seed: number }) {
super.init({ count, seed });
this.checks({ count });
let { maxRepeatedValuesCount } = this;
const { params, isUnique, notNull, weightedCountSeed } = this;
const values = params.values;
let valuesWeightedIndices;
if (isObject(values[0])) {
valuesWeightedIndices = getWeightedIndices((values as { weight: number }[]).map((val) => val.weight));
if (isUnique === true && notNull === true) {
let idx: number, valueIdx: number, rng = prand.xoroshiro128plus(seed);View on GitHub (pinned to b7862528fd)
Solutions
- Increase the number of available values, reduce the requested row count, or drop the unique constraint so values can repeat.
When it happens
Trigger: Requesting more rows than the pool of available unique values for a unique column generator.
Common situations: valuesFromArray with fewer entries than the requested count on a unique column; narrow unique ranges.
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/d4714c8cb0d88e13.json.
Report an issue: GitHub.