apache/pulsar · error · IllegalArgumentException

${paramName} cannot be less than or equal to 0!

Error message

${paramName} cannot be less than or equal to 0!

What it means

Bounds check in CmdUtils.positiveCheck: a CLI parameter that must be strictly positive (e.g. a size, count, or timeout) was passed as zero or negative; paramName names the offending option and value is the faulty input.

Source

Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java:61

            } else if (ex instanceof InvalidFormatException) {

                InvalidFormatException invalidFormatException = (InvalidFormatException) ex;
                String exceptionMessage = String.format("Failed to parse config file %s. %s on line: %d column: %d",
                        file,
                        invalidFormatException.getOriginalMessage(),
                        invalidFormatException.getLocation().getLineNr(),
                        invalidFormatException.getLocation().getColumnNr());

                throw new IllegalArgumentException(exceptionMessage);
            } else {
                throw new IllegalArgumentException(ex.getMessage());
            }
        }
    }

    public static boolean positiveCheck(String paramName, long value) {
        if (value <= 0) {
            throw new IllegalArgumentException(paramName + " cannot be less than or equal to 0!");
        }
        return true;
    }

    public static boolean maxValueCheck(String paramName, long value, long maxValue) {
        if (value > maxValue) {
            throw new IllegalArgumentException(paramName + " cannot be greater than " + maxValue + "!");
        }
        return true;
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Supply a value greater than 0 for the named parameter
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java:61 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/d3d399ae095263ec. Report an issue: GitHub.