{"id":"e35971f60e15bd6a","repo":"drizzle-team/drizzle-orm","slug":"can-t-fill-notnull-column-with-null-values","errorCode":null,"errorMessage":"Can't fill notNull column with null values.","messagePattern":"Can't fill notNull column with null values\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/Generators.ts","lineNumber":255,"sourceCode":"\t\t\tthrow new Error('maxRepeatedValuesCount should be greater than zero.');\n\t\t}\n\n\t\tlet allValuesCount = values.length;\n\t\tif (isObject(values[0])) {\n\t\t\tallValuesCount = (values as { values: any[] }[]).reduce((acc, currVal) => acc + currVal.values.length, 0);\n\t\t}\n\n\t\tif (\n\t\t\tnotNull === true\n\t\t\t&& maxRepeatedValuesCount !== undefined\n\t\t\t&& (\n\t\t\t\t(!isObject(values[0]) && typeof maxRepeatedValuesCount === 'number'\n\t\t\t\t\t&& maxRepeatedValuesCount * values.length < count)\n\t\t\t\t|| (isObject(values[0]) && typeof maxRepeatedValuesCount === 'number'\n\t\t\t\t\t&& maxRepeatedValuesCount * allValuesCount < count)\n\t\t\t)\n\t\t) {\n\t\t\tthrow new Error(\"Can't fill notNull column with null values.\");\n\t\t}\n\n\t\tif (\n\t\t\tisUnique === true && maxRepeatedValuesCount !== undefined && (\n\t\t\t\t(typeof maxRepeatedValuesCount === 'number' && maxRepeatedValuesCount > 1)\n\t\t\t\t|| (typeof maxRepeatedValuesCount === 'object' && !maxRepeatedValuesCount\n\t\t\t\t\t.every((obj) =>\n\t\t\t\t\t\t(typeof obj.count) === 'number'\n\t\t\t\t\t\t\t? obj.count === 1\n\t\t\t\t\t\t\t: (obj.count as number[]).every((count) => count === 1)\n\t\t\t\t\t))\n\t\t\t)\n\t\t) {\n\t\t\tthrow new Error(\"Can't be greater than 1 if column is unique.\");\n\t\t}\n\n\t\tif (\n\t\t\tisUnique === true && notNull === true && (","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/Generators.ts#L237-L273","documentation":"Error \"Can't fill notNull column with null values.\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"A generator is asked to emit null into a NOT NULL column (e.g. defaultNullChance/weighted nulls on a notNull column).","commonSituations":"Including null among weighted values for a notNull column; high null weight on required fields.","solutions":["Remove null from the values pool or allow nulls by dropping the notNull constraint 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}