drizzle-team/drizzle-orm · error · Error

maxRepeatedValuesCount should be greater than zero.

Error message

maxRepeatedValuesCount should be greater than zero.

What it means

Error "maxRepeatedValuesCount should be greater than zero." thrown in drizzle-team/drizzle-orm.

Source

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

		if (
			isObject(values[0])
			&& !(values as { weight: number; values: any[] }[]).every((val) => val.values.length !== 0)
		) {
			throw new Error('One of weighted values length equals zero.');
		}

		if (
			maxRepeatedValuesCount !== undefined && (
				(typeof maxRepeatedValuesCount === 'number' && maxRepeatedValuesCount <= 0)
				|| (typeof maxRepeatedValuesCount === 'object' && !maxRepeatedValuesCount
					.every((obj) =>
						(typeof obj.count) === 'number'
							? (obj.count as number) > 0
							: (obj.count as number[]).every((count) => count > 0)
					))
			)
		) {
			throw new Error('maxRepeatedValuesCount should be greater than zero.');
		}

		let allValuesCount = values.length;
		if (isObject(values[0])) {
			allValuesCount = (values as { values: any[] }[]).reduce((acc, currVal) => acc + currVal.values.length, 0);
		}

		if (
			notNull === true
			&& maxRepeatedValuesCount !== undefined
			&& (
				(!isObject(values[0]) && typeof maxRepeatedValuesCount === 'number'
					&& maxRepeatedValuesCount * values.length < count)
				|| (isObject(values[0]) && typeof maxRepeatedValuesCount === 'number'
					&& maxRepeatedValuesCount * allValuesCount < count)
			)
		) {
			throw new Error("Can't fill notNull column with null values.");

View on GitHub (pinned to b7862528fd)

Solutions

  1. Set maxRepeatedValuesCount to a positive integer greater than zero in the generator configuration.

When it happens

Trigger: Setting maxRepeatedValuesCount to zero or a negative number in a drizzle-seed generator.

Common situations: Copy-pasted config with 0; computed repetition count that rounded down to zero.


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