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