xuxueli/xxl-job · error · ParseException

Increment >= 24 : {}

Error message

Increment >= 24 : {}

What it means

Thrown by checkIncrementRange when a step/increment value in the hours field exceeds 23. The hours field cycles through 0-23, so an increment of 24 or more is meaningless.

Source

Thrown at xxl-job-admin/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java:730

                    ValueSet vs = getValue(val, s, i);
                    val = vs.value;
                    i = vs.pos;
                }
                i = checkNext(i, s, val, type);
                return i;
            }
        } else {
            throw new ParseException("Unexpected character: " + c, i);
        }

        return i;
    }

    private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {
        if (incr > 59 && (type == SECOND || type == MINUTE)) {
            throw new ParseException("Increment >= 60 : " + incr, idxPos);
        } else if (incr > 23 && (type == HOUR)) {
            throw new ParseException("Increment >= 24 : " + incr, idxPos);
        } else if (incr > 31 && (type == DAY_OF_MONTH)) {
            throw new ParseException("Increment >= 31 : " + incr, idxPos);
        } else if (incr > 7 && (type == DAY_OF_WEEK)) {
            throw new ParseException("Increment >= 7 : " + incr, idxPos);
        } else if (incr > 12 && (type == MONTH)) {
            throw new ParseException("Increment >= 12 : " + incr, idxPos);
        }
    }

    protected int checkNext(int pos, String s, int val, int type)
            throws ParseException {

        int end = -1;
        int i = pos;

        if (i >= s.length()) {
            addToSet(val, end, -1, type);
            return i;

View on GitHub (pinned to e74c784f68)

Solutions

  1. Reduce the hour increment to 23 or less.
  2. For intervals longer than a day, use the day-of-month field instead.
  3. Validate step values against 23 for the hours field before constructing the expression.

Example fix

// before
"* 0/30 * * * ?"
// after
"* 0/12 * * * ?"
Defensive patterns

Strategy: validation

Validate before calling

// Validate step increment for hours (field index 2)
String[] parts = cron.trim().split("\\s+");
if (parts.length > 2 && parts[2].contains("/")) {
    int step = Integer.parseInt(parts[2].substring(parts[2].indexOf("/") + 1));
    if (step > 23) throw new IllegalArgumentException("Hour step must be <= 23: " + step);
}

Type guard

boolean isValidHourStep(String hourField) {
    if (!hourField.contains("/")) return true;
    int step = Integer.parseInt(hourField.substring(hourField.indexOf("/") + 1));
    return step >= 1 && step <= 23;

Try / catch

try {
    new CronExpression(cron);
} catch (ParseException e) {
    if (e.getMessage().contains("Increment >= 24")) {
        // move to day-based scheduling
    }
}

Prevention

When it happens

Trigger: A cron expression like '* 0/24 * * * ?' where the increment after '/' in the hour field is >= 24. The check at line 729 tests incr > 23 with type HOUR.

Common situations: Generating an increment for the hours field from a minutes-based calculation without converting, or copying a pattern from another field.

Related errors


AI-assisted analysis of xuxueli/xxl-job@e74c784f68 (2026-08-14). Data as JSON: /api/errors/2215918fd98b50b7. Report an issue: GitHub.