{"record":{"id":"c3af631f1a13e784","repo":"apache/cassandra","slug":"minimum-name-size-config-option-has-to-be-at-least","errorCode":null,"errorMessage":"MINIMUM_NAME_SIZE_CONFIG_OPTION has to be at least DEFAULT_MINIMUM_NAME_SIZE and at most MAXIMUM_NAME_SIZE","messagePattern":"MINIMUM_NAME_SIZE_CONFIG_OPTION has to be at least DEFAULT_MINIMUM_NAME_SIZE and at most MAXIMUM_NAME_SIZE","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/guardrails/UUIDRoleNameGenerator.java","lineNumber":119,"sourceCode":"        name = name.substring(0, size);\n        name = enrich(NAME_PREFIX_KEY, name, options);\n        name = enrich(NAME_SUFFIX_KEY, name, options);\n\n        return name;\n    }\n\n    @Nonnull\n    @Override\n    public CustomGuardrailConfig getParameters()\n    {\n        return config;\n    }\n\n    @Override\n    public void validateParameters() throws ConfigurationException\n    {\n        if (minimumNameSize < DEFAULT_MINIMUM_NAME_SIZE || minimumNameSize > MAXIMUM_NAME_SIZE)\n            throw new ConfigurationException(MINIMUM_NAME_SIZE_CONFIG_OPTION + \" has to be at least \" + DEFAULT_MINIMUM_NAME_SIZE + \" and at most \" + MAXIMUM_NAME_SIZE);\n    }\n\n    private String enrich(String key, String generatedValue, Map<String, Object> options)\n    {\n        if (options == null || options.isEmpty())\n            return generatedValue;\n\n        if (options.containsKey(key))\n        {\n            Object value = options.get(key);\n\n            if (value == null)\n                throw new IllegalArgumentException(\"Value of \" + key + \" cannot be null.\");\n\n            if (!(value instanceof String))\n                throw new IllegalArgumentException(\"Value of \" + key + \" is not a string.\");\n\n            if (NAME_PREFIX_KEY.equals(key))","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/guardrails/UUIDRoleNameGenerator.java#L101-L137","documentation":"UUIDRoleNameGenerator.validateParameters() throws this ConfigurationException when the 'minimum_name_size' config option is outside the allowed range: below DEFAULT_MINIMUM_NAME_SIZE or above MAXIMUM_NAME_SIZE. It runs at generator construction/registration time, so a bad generator config prevents the role-name generator from being usable.","triggerScenarios":"Configuring UUIDRoleNameGenerator with minimum_name_size smaller than the built-in default minimum or larger than MAXIMUM_NAME_SIZE (36 for a UUID string), then calling validateParameters during creation.","commonSituations":"Operators setting minimum_name_size=0 or negative values believing 0 means 'unconstrained', or typos like 360 instead of 36 when intending to cap name length.","solutions":["Set minimum_name_size between DEFAULT_MINIMUM_NAME_SIZE and MAXIMUM_NAME_SIZE (36)","Read the message numbers: first value is the lower bound, second the upper bound; clamp your config into that range","If you want short names, use the smallest allowed minimum rather than 0"],"exampleFix":"// before\nminimum_name_size: 0\n// after\nminimum_name_size: 4","handlingStrategy":"validation","validationCode":"void checkMin(int minimumNameSize) {\n    if (minimumNameSize < DEFAULT_MINIMUM_NAME_SIZE || minimumNameSize > MAXIMUM_NAME_SIZE)\n        throw new IllegalArgumentException(\"minimum_name_size must be in [\" + DEFAULT_MINIMUM_NAME_SIZE + \",\" + MAXIMUM_NAME_SIZE + \"]\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    generator.validateParameters();\n} catch (ConfigurationException e) {\n    if (e.getMessage().startsWith(\"minimum_name_size\")) {\n        // clamp config value into [DEFAULT_MINIMUM_NAME_SIZE, 36] and recreate\n    } else throw e;\n}","preventionTips":["Clamp minimum_name_size into [DEFAULT_MINIMUM_NAME_SIZE, 36] in your config loader","Never use 0 or negative values to mean 'no minimum'","Document the valid range next to the config key"],"tags":["guardrails","configuration","validation","range"],"backgroundTag":"value-out-of-range","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}