{"id":"53c6d957093dbb06","repo":"drizzle-team/drizzle-orm","slug":"count-exceeds-max-number-of-unique-last-names","errorCode":null,"errorMessage":"count exceeds max number of unique last names.","messagePattern":"count exceeds max number of unique last names\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/Generators.ts","lineNumber":1685,"sourceCode":"\n\t\tlet idx: number;\n\n\t\t[idx, this.state.rng] = prand.uniformIntDistribution(0, lastNames.length - 1, this.state.rng);\n\t\treturn lastNames[idx];\n\t}\n}\n\nexport class GenerateUniqueLastName extends AbstractGenerator<{ isUnique?: boolean }> {\n\tstatic override readonly entityKind: string = 'GenerateUniqueLastName';\n\n\tprivate state: {\n\t\tgenIndicesObj: GenerateUniqueInt;\n\t} | undefined;\n\tpublic override isUnique = true;\n\n\toverride init({ count, seed }: { count: number; seed: number }) {\n\t\tif (count > lastNames.length) {\n\t\t\tthrow new Error('count exceeds max number of unique last names.');\n\t\t}\n\n\t\tif (this.stringLength !== undefined && this.stringLength < maxLastNameLength) {\n\t\t\tthrow new Error(\n\t\t\t\t`You can't use last name generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxLastNameLength}.`,\n\t\t\t);\n\t\t}\n\n\t\tconst genIndicesObj = new GenerateUniqueInt({ minValue: 0, maxValue: lastNames.length - 1 });\n\t\tgenIndicesObj.init({ count, seed });\n\n\t\tthis.state = { genIndicesObj };\n\t}\n\n\tgenerate() {\n\t\tif (this.state === undefined) {\n\t\t\tthrow new Error('state is not defined.');\n\t\t}","sourceCodeStart":1667,"sourceCodeEnd":1703,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/Generators.ts#L1667-L1703","documentation":"Error \"count exceeds max number of unique last names.\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"Requesting more unique last names than the generator's last-name pool contains.","commonSituations":"Large seed counts on a unique last-name column.","solutions":["Reduce the requested unique last-name count or drop the unique constraint."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}