{"id":"ad0d11577f4ada33","repo":"drizzle-team/drizzle-orm","slug":"you-can-t-use-email-generator-with-a-db-column-len","errorCode":null,"errorMessage":"You can't use email generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxEmailLength}.","messagePattern":"You can't use email generator with a db column length restriction of (.+?)\\. Set the maximum string length to at least (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/Generators.ts","lineNumber":1851,"sourceCode":"\tpublic override isUnique = true;\n\n\toverride init({ count, seed }: { count: number; seed: number }) {\n\t\tsuper.init({ count, seed });\n\n\t\tconst domainsArray = emailDomains;\n\t\tconst adjectivesArray = adjectives;\n\t\tconst namesArray = firstNames;\n\n\t\tconst maxUniqueEmailsNumber = adjectivesArray.length * namesArray.length * domainsArray.length;\n\t\tif (count > maxUniqueEmailsNumber) {\n\t\t\tthrow new RangeError(\n\t\t\t\t`count exceeds max number of unique emails(${maxUniqueEmailsNumber}).`,\n\t\t\t);\n\t\t}\n\n\t\tconst maxEmailLength = maxAdjectiveLength + maxFirstNameLength + maxEmailDomainLength + 2;\n\t\tif (this.stringLength !== undefined && this.stringLength < maxEmailLength) {\n\t\t\tthrow new Error(\n\t\t\t\t`You can't use email generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxEmailLength}.`,\n\t\t\t);\n\t\t}\n\n\t\tconst arraysToGenerateFrom = [adjectivesArray, namesArray, domainsArray];\n\t\tconst genIndicesObj = new GenerateUniqueInt({\n\t\t\tminValue: 0,\n\t\t\tmaxValue: maxUniqueEmailsNumber - 1,\n\t\t});\n\t\tgenIndicesObj.init({ count, seed });\n\n\t\tthis.state = { genIndicesObj, arraysToGenerateFrom };\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":1833,"sourceCodeEnd":1869,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/Generators.ts#L1833-L1869","documentation":"Error \"You can't use email generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxEmailLength}.\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"Using the email generator on a varchar column shorter than the maximum generated email length.","commonSituations":"varchar(n) too small for emails; increase to at least maxEmailLength.","solutions":["Increase the column's maximum string length to at least the required email length, or use a different generator."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}