{"record":{"id":"573314eebb3299da","repo":"apache/pulsar","slug":"name-cannot-be-less-than-min","errorCode":null,"errorMessage":"${name} cannot be less than <${min}>!","messagePattern":"(.+?) cannot be less than <(.+?)>!","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/ValueValidationUtil.java","lineNumber":53,"sourceCode":"            throw new IllegalArgumentException(paramName + \" cannot be less than or equal to <0>!\");\n        }\n    }\n\n    public static void positiveCheck(String paramName, int value) {\n        if (value <= 0) {\n            throw new IllegalArgumentException(paramName + \" cannot be less than or equal to <0>!\");\n        }\n    }\n\n    public static void emptyCheck(String paramName, String value) {\n        if (StringUtils.isEmpty(value)) {\n            throw new IllegalArgumentException(\"The value of \" + paramName + \" can't be empty\");\n        }\n    }\n\n    public static void minValueCheck(String name, Long value, long min) {\n        if (value < min) {\n            throw new IllegalArgumentException(name + \" cannot be less than <\" + min + \">!\");\n        }\n    }\n}\n","sourceCodeStart":35,"sourceCodeEnd":57,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/ValueValidationUtil.java#L35-L57","documentation":"ValueValidationUtil.minValueCheck rejects a nullable Long parameter smaller than a configured minimum, throwing '<name> cannot be less than <min>!'. It enforces lower bounds on CLI options (e.g. minimum retention, message TTL floors).","triggerScenarios":"Calling minValueCheck(name, value, min) with value < min (value is a Long, so an unboxed comparison) — e.g. --retention-time below the tool's minimum allowed minutes.","commonSituations":"Passing small time/size values that fall under a documented floor; unit confusion (seconds vs minutes); computed values (now - horizon) going below the minimum.","solutions":["Raise the parameter value to at least the reported min.","Verify units — the min is often expressed in a different unit than you assumed (seconds vs minutes, MB vs bytes).","Clamp computed values in scripts before passing them: value < min ? min : value.","Consult the tool docs for the minimum allowed value if the bound seems unexpected."],"exampleFix":"// before (min is 60 seconds)\npulsar-admin namespaces set-retention --time 30 ...\n// after\npulsar-admin namespaces set-retention --time 60 ...","handlingStrategy":"validation","validationCode":"public static long requireAtLeast(String name, Long value, long min) {\n    if (value == null || value < min) {\n        throw new IllegalArgumentException(name + \" must be >= \" + min + \", got \" + value);\n    }\n    return value;\n}\n// call before the CLI tool: requireAtLeast(\"retention-time\", retentionMinutes, 60);","typeGuard":null,"tryCatchPattern":"try {\n    tool.run(args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"cannot be less than\")) {\n        System.err.println(\"Raise the value: \" + e.getMessage());\n    } else throw e;\n}","preventionTips":["Confirm units before comparing against the minimum (minutes vs seconds, MB vs bytes).","Clamp computed values to the documented floor in scripts.","Keep configurable minimums in one place in wrapper scripts for consistency.","Check tool docs for floor values that differ between Pulsar versions."],"tags":["cli","validation","argument","pulsar"],"backgroundTag":"argument-out-of-range","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}