drizzle-team/drizzle-orm · error · Error
count exceeds max number of unique first names.
Error message
count exceeds max number of unique first names.
What it means
Error "count exceeds max number of unique first names." thrown in drizzle-team/drizzle-orm.
Source
Thrown at drizzle-seed/src/services/Generators.ts:1611
[idx, this.state.rng] = prand.uniformIntDistribution(0, firstNames.length - 1, this.state.rng);
return firstNames[idx] as string;
}
}
export class GenerateUniqueFirstName extends AbstractGenerator<{
isUnique?: boolean;
}> {
static override readonly entityKind: string = 'GenerateUniqueFirstName';
private state: {
genIndicesObj: GenerateUniqueInt;
} | undefined;
public override isUnique = true;
override init({ count, seed }: { count: number; seed: number }) {
if (count > firstNames.length) {
throw new Error('count exceeds max number of unique first names.');
}
if (this.stringLength !== undefined && this.stringLength < maxFirstNameLength) {
throw new Error(
`You can't use first name generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxFirstNameLength}.`,
);
}
const genIndicesObj = new GenerateUniqueInt({ minValue: 0, maxValue: firstNames.length - 1 });
genIndicesObj.init({ count, seed });
this.state = { genIndicesObj };
}
generate() {
// names dataset contains about 30000 unique names.
if (this.state === undefined) {
throw new Error('state is not defined.');View on GitHub (pinned to b7862528fd)
Solutions
- Reduce the requested unique first-name count or drop the unique constraint.
When it happens
Trigger: Requesting more unique first names than the generator's first-name pool contains.
Common situations: Very large seed counts on a unique first-name column.
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/c83de6fde579314f.json.
Report an issue: GitHub.