drizzle-team/drizzle-orm · error · Error
You can't use last name generator with a db column length re
Error message
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}. What it means
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}." thrown in drizzle-team/drizzle-orm.
Source
Thrown at drizzle-seed/src/services/Generators.ts:1656
export class GenerateLastName extends AbstractGenerator<{
isUnique?: boolean;
arraySize?: number;
}> {
static override readonly entityKind: string = 'GenerateLastName';
private state: {
rng: prand.RandomGenerator;
} | undefined;
override uniqueVersionOfGen = GenerateUniqueLastName;
override init({ count, seed }: { count: number; seed: number }) {
super.init({ count, seed });
const rng = prand.xoroshiro128plus(seed);
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}.`,
);
}
this.state = { rng };
}
generate() {
if (this.state === undefined) {
throw new Error('state is not defined.');
}
let idx: number;
[idx, this.state.rng] = prand.uniformIntDistribution(0, lastNames.length - 1, this.state.rng);
return lastNames[idx];
}
}
View on GitHub (pinned to b7862528fd)
Solutions
- Increase the column's maximum string length to at least the required last-name length, or use a different generator.
When it happens
Trigger: Using the last-name generator on a varchar column shorter than the longest possible last name.
Common situations: varchar(n) too small for generated surnames; raise the max string length.
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/e768fd4bcb557731.json.
Report an issue: GitHub.