{"id":"d21dad7a7258a32a","repo":"drizzle-team/drizzle-orm","slug":"specifying-non-unique-generator-to-unique-column","errorCode":null,"errorMessage":"specifying non unique generator to unique column.","messagePattern":"specifying non unique generator to unique column\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/Generators.ts","lineNumber":59,"sourceCode":"\tpublic params: T;\n\n\tconstructor(params?: T) {\n\t\tthis.params = params === undefined ? {} as T : params as T;\n\t}\n\n\tinit(params: { count: number | { weight: number; count: number | number[] }[]; seed: number }): void;\n\tinit() {\n\t\tthis.updateParams();\n\t}\n\n\tupdateParams() {\n\t\tif ((this.params as any).arraySize !== undefined) {\n\t\t\tthis.arraySize = (this.params as any).arraySize;\n\t\t}\n\n\t\tif ((this.params as any).isUnique !== undefined) {\n\t\t\tif ((this.params as any).isUnique === false && this.isUnique === true) {\n\t\t\t\tthrow new Error('specifying non unique generator to unique column.');\n\t\t\t}\n\n\t\t\tthis.isUnique = (this.params as any).isUnique;\n\t\t}\n\t}\n\n\tabstract generate(params: { i: number }): number | string | boolean | unknown | undefined | void;\n\n\tgetEntityKind(): string {\n\t\tconst constructor = this.constructor as typeof AbstractGenerator;\n\t\treturn constructor.entityKind;\n\t}\n\n\treplaceIfUnique() {\n\t\tthis.updateParams();\n\t\tif (\n\t\t\tthis.uniqueVersionOfGen !== undefined\n\t\t\t&& this.isUnique === true","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/Generators.ts#L41-L77","documentation":"Error \"specifying non unique generator to unique column.\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"Assigning a non-unique generator (e.g. default string/number generator) to a column marked unique in drizzle-seed refinements.","commonSituations":"Forgetting to use a unique* generator variant for unique columns in the seed refinements map.","solutions":["Use a unique generator (e.g. the unique variant of the generator) for columns marked unique, or remove the unique constraint from 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}