drizzle-team/drizzle-orm · error · RangeError

count exceeds max number of unique full names(${maxUniqueFul

Error message

count exceeds max number of unique full names(${maxUniqueFullNamesNumber}).

What it means

Error "count exceeds max number of unique full names(${maxUniqueFullNamesNumber})." thrown in drizzle-team/drizzle-orm.

Source

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

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

	private state: {
		fullnameSet: Set<string>;
		rng: prand.RandomGenerator;
	} | undefined;
	public override isUnique = true;
	public override timeSpent = 0;

	override init({ count, seed }: { count: number; seed: number }) {
		const t0 = new Date();

		const maxUniqueFullNamesNumber = firstNames.length * lastNames.length;
		if (count > maxUniqueFullNamesNumber) {
			throw new RangeError(
				`count exceeds max number of unique full names(${maxUniqueFullNamesNumber}).`,
			);
		}

		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
				}.`,
			);
		}

		const rng = prand.xoroshiro128plus(seed);
		const fullnameSet = new Set<string>();

		this.state = { rng, fullnameSet };
		this.timeSpent += (Date.now() - t0.getTime()) / 1000;
	}

View on GitHub (pinned to b7862528fd)

Solutions

  1. Reduce the requested unique full-name count or drop the unique constraint.

When it happens

Trigger: Requesting more unique full names than the generator can compose.

Common situations: Large counts on a unique full-name column exceeding maxUniqueFullNamesNumber.


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