drizzle-team/drizzle-orm · error · Error

count exceeds max number for this column type.

Error message

count exceeds max number for this column type.

What it means

Error "count exceeds max number for this column type." thrown in drizzle-team/drizzle-orm.

Source

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

		if (i < this.state.firstValuesCount) {
			this.state.firstValues.push(values[i]!);
			return values[i];
		} else {
			[idx, this.state.rng] = prand.uniformIntDistribution(0, this.state.firstValues.length - 1, this.state.rng);
			return this.state.firstValues[idx];
		}
	}
}

export class GenerateIntPrimaryKey extends AbstractGenerator<{}> {
	static override readonly entityKind: string = 'GenerateIntPrimaryKey';

	public maxValue?: number | bigint;

	override init({ count }: { count: number; seed: number }) {
		if (this.maxValue !== undefined && count > this.maxValue) {
			throw new Error('count exceeds max number for this column type.');
		}
	}

	generate({ i }: { i: number }) {
		if (this.dataType === 'bigint') {
			return BigInt(i + 1);
		}

		return i + 1;
	}
}

export class GenerateNumber extends AbstractGenerator<
	{
		minValue?: number;
		maxValue?: number;
		precision?: number;
		isUnique?: boolean;

View on GitHub (pinned to b7862528fd)

Solutions

  1. Lower the requested count or choose a generator/column type with a larger value domain.

When it happens

Trigger: Requesting a generation count that exceeds the maximum number of distinct values the column type supports.

Common situations: Seeding more rows than a boolean/small-range/short-string column can uniquely produce.


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