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