drizzle-team/drizzle-orm · error · Error

You can't use full name generator with a db column length re

Error message

You can't use full name generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxFirstNameLength + maxLastNameLength + 1}.

What it means

Error "You can't use full name generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxFirstNameLength + maxLastNameLength + 1}." thrown in drizzle-team/drizzle-orm.

Source

Thrown at drizzle-seed/src/services/Generators.ts:1729

export class GenerateFullName extends AbstractGenerator<{
	isUnique?: boolean;
	arraySize?: number;
}> {
	static override readonly entityKind: string = 'GenerateFullName';

	private state: {
		rng: prand.RandomGenerator;
	} | undefined;
	override uniqueVersionOfGen = GenerateUniqueFullName;

	override init({ count, seed }: { count: number; seed: number }) {
		super.init({ count, seed });

		const rng = prand.xoroshiro128plus(seed);

		if (this.stringLength !== undefined && this.stringLength < (maxFirstNameLength + maxLastNameLength + 1)) {
			throw new Error(
				`You can't use full name generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${
					maxFirstNameLength + maxLastNameLength + 1
				}.`,
			);
		}

		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, firstNames.length - 1, this.state.rng);
		const name = firstNames[idx] as string;

View on GitHub (pinned to b7862528fd)

Solutions

  1. Increase the column's maximum string length to at least first-name + last-name + 1 characters, or use a different generator.

When it happens

Trigger: Using the full-name generator on a varchar column shorter than first+last+space maximum length.

Common situations: Undersized full-name column; set max length to at least maxFirstNameLength + maxLastNameLength + 1.


AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03). Data as JSON: /data/errors/4a5a0ea2fa003ace.json. Report an issue: GitHub.