alibaba/nacos · error · IllegalArgumentException
startInclusive must be less than or equal to the endExclusiv
Error message
startInclusive must be less than or equal to the endExclusive.
What it means
Error "startInclusive must be less than or equal to the endExclusive." thrown in alibaba/nacos.
Source
Thrown at common/src/main/java/com/alibaba/nacos/common/utils/RandomUtils.java:78
*/
public static int nextInt(final int startInclusive, final int endExclusive) {
checkParameters(startInclusive, endExclusive);
int diff = endExclusive - startInclusive;
if (diff == 0) {
return startInclusive;
}
return startInclusive + RANDOM.nextInt(diff);
}
/**
* Check input parameters.
*
* @param startInclusive lower limit, must be non-negative
* @param endExclusive the upper bound (not included)
*/
private static void checkParameters(final long startInclusive, final long endExclusive) {
if (endExclusive < startInclusive) {
throw new IllegalArgumentException(
"startInclusive must be less than or equal to the endExclusive.");
}
if (startInclusive < 0) {
throw new IllegalArgumentException("Both parameters must be non-negative");
}
}
}
View on GitHub (pinned to 9b989acdf1)
Solutions
- Correct the invalid value for RandomUtils range to match the expected format or allowed set, then retry.
When it happens
Trigger: Thrown at common/src/main/java/com/alibaba/nacos/common/utils/RandomUtils.java:78 when the library encounters an invalid state.
Common situations: Requesting a random value with startInclusive greater than endExclusive.
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/cb3313c940dce55c.
Report an issue: GitHub.