drizzle-team/drizzle-orm · error · Error
You can't use city generator with a db column length restric
Error message
You can't use city generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxCityNameLength}. What it means
Error "You can't use city generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxCityNameLength}." thrown in drizzle-team/drizzle-orm.
Source
Thrown at drizzle-seed/src/services/Generators.ts:2354
export class GenerateCity extends AbstractGenerator<{
isUnique?: boolean;
arraySize?: number;
}> {
static override readonly entityKind: string = 'GenerateCity';
private state: {
rng: prand.RandomGenerator;
} | undefined;
override uniqueVersionOfGen = GenerateUniqueCity;
override init({ count, seed }: { count: number; seed: number }) {
super.init({ count, seed });
const rng = prand.xoroshiro128plus(seed);
if (this.stringLength !== undefined && this.stringLength < maxCityNameLength) {
throw new Error(
`You can't use city generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxCityNameLength}.`,
);
}
this.state = { rng };
}
generate() {
if (this.state === undefined) {
throw new Error('state is not defined.');
}
let idx;
[idx, this.state.rng] = prand.uniformIntDistribution(0, cityNames.length - 1, this.state.rng);
return cityNames[idx];
}
}View on GitHub (pinned to b7862528fd)
Solutions
- Increase the column's maximum string length to at least the maximum city-name length, or use a different generator.
When it happens
Trigger: Using the city generator on a column shorter than the longest city name.
Common situations: Short varchar for cities; raise to maxCityNameLength.
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/54b4fb63029714c7.json.
Report an issue: GitHub.