drizzle-team/drizzle-orm · error · Error
count exceeds max number of unique integers in given range(m
Error message
count exceeds max number of unique integers in given range(min, max), try to make range wider.
What it means
Error "count exceeds max number of unique integers in given range(min, max), try to make range wider." thrown in drizzle-team/drizzle-orm.
Source
Thrown at drizzle-seed/src/services/Generators.ts:679
override init({ count, seed }: { count: number; seed: number }) {
const rng = prand.xoroshiro128plus(seed);
let { minValue, maxValue } = this.params;
if (maxValue === undefined) {
maxValue = count * 10;
}
if (minValue === undefined) {
minValue = -maxValue;
}
const intervals = [[minValue, maxValue]];
const integersCount = new Map();
if (typeof minValue === 'bigint' && typeof maxValue === 'bigint') {
if (this.skipCheck === false && maxValue - minValue + BigInt(1) < count) {
throw new Error(
'count exceeds max number of unique integers in given range(min, max), try to make range wider.',
);
}
} else if (typeof minValue === 'number' && typeof maxValue === 'number') {
minValue = minValue >= 0 ? Math.ceil(minValue) : Math.floor(minValue);
maxValue = maxValue >= 0 ? Math.floor(maxValue) : Math.ceil(maxValue);
if (this.skipCheck === false && maxValue - minValue + 1 < count) {
throw new Error(
'count exceeds max number of unique integers in given range(min, max), try to make range wider.',
);
}
} else {
throw new Error(
'minValue and maxValue should be the same type.',
);
}
this.state = { rng, minValue, maxValue, intervals, integersCount };View on GitHub (pinned to b7862528fd)
Solutions
- Widen the (min, max) range or reduce the count of unique integers requested.
When it happens
Trigger: generateUniqueInt with count larger than (max - min + 1) for the given integer range.
Common situations: Too-narrow min/max range on a unique integer column; large seed count with default range.
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/2e61d7717ddaad00.json.
Report an issue: GitHub.