{"id":"c4a66cd56e52acad","repo":"drizzle-team/drizzle-orm","slug":"weighted-values-arrays-is-too-small-to-generate-va","errorCode":null,"errorMessage":"weighted values arrays is too small to generate values with specified probability for unique not null column.it's planned to generate: ${...}","messagePattern":"weighted values arrays is too small to generate values with specified probability for unique not null column\\.it's planned to generate: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/Generators.ts","lineNumber":308,"sourceCode":"\n\t\tconst values = params.values;\n\n\t\tlet valuesWeightedIndices;\n\t\tif (isObject(values[0])) {\n\t\t\tvaluesWeightedIndices = getWeightedIndices((values as { weight: number }[]).map((val) => val.weight));\n\t\t\tif (isUnique === true && notNull === true) {\n\t\t\t\tlet idx: number, valueIdx: number, rng = prand.xoroshiro128plus(seed);\n\t\t\t\tconst indicesCounter: { [key: number]: number } = {};\n\t\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\t\t[idx, rng] = prand.uniformIntDistribution(0, valuesWeightedIndices.length - 1, rng);\n\t\t\t\t\tvalueIdx = valuesWeightedIndices[idx]!;\n\t\t\t\t\tif (!Object.hasOwn(indicesCounter, valueIdx)) indicesCounter[valueIdx] = 0;\n\t\t\t\t\tindicesCounter[valueIdx]! += 1;\n\t\t\t\t}\n\n\t\t\t\tfor (const [idx, value] of values.entries()) {\n\t\t\t\t\tif ((value as { values: (number | string | boolean | undefined)[] }).values.length < indicesCounter[idx]!) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t'weighted values arrays is too small to generate values with specified probability for unique not null column.'\n\t\t\t\t\t\t\t\t+ `it's planned to generate: ${\n\t\t\t\t\t\t\t\t\tObject.entries(indicesCounter).map(([idx, count]) => {\n\t\t\t\t\t\t\t\t\t\treturn `${count} values with probability ${(values as { weight: number }[])[Number(idx)]?.weight}`;\n\t\t\t\t\t\t\t\t\t}).join(',')\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (isUnique === true && maxRepeatedValuesCount === undefined) {\n\t\t\tmaxRepeatedValuesCount = 1;\n\t\t}\n\t\tlet genMaxRepeatedValuesCount: GenerateDefault | GenerateWeightedCount | undefined;\n\t\tif (typeof maxRepeatedValuesCount === 'number') {\n\t\t\tgenMaxRepeatedValuesCount = new GenerateDefault({ defaultValue: maxRepeatedValuesCount });\n\t\t} else if (typeof maxRepeatedValuesCount === 'object') {","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/Generators.ts#L290-L326","documentation":"Error \"weighted values arrays is too small to generate values with specified probability for unique not null column.it's planned to generate: ${...}\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"Weighted values arrays are too small to satisfy the requested generation count/probability for a unique not-null column.","commonSituations":"Small weighted candidate pools combined with large seed counts; probabilities forcing reuse of unique values.","solutions":["Add more weighted values, lower the requested count/probability, or relax the unique/notNull constraints on the column."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}