xuxueli/xxl-job · error · ParseException

Increment >= 12 : {}

Error message

Increment >= 12 : {}

What it means

Thrown by checkIncrementRange when a step/increment value in the Month field exceeds 12. The month field cycles through 1-12, so an increment of 13 or more is rejected.

Source

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

            }
        } 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;
        }

        char c = s.charAt(pos);

        if (c == 'L') {
            if (type == DAY_OF_WEEK) {

View on GitHub (pinned to e74c784f68)

Solutions

  1. Reduce the month increment to 12 or less.
  2. If an annual or bi-annual schedule is needed, use a value like '1/6' (every 6 months) or '1/12' (yearly).
  3. Validate step values against 12 for the month field before building the expression.

Example fix

// before
"0 0 0 1 1/15 ?"
// after
"0 0 0 1 1/6 ?"
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try {
    new CronExpression(cron);
} catch (ParseException e) {
    if (e.getMessage().contains("Increment >= 12")) {
        // the schedule interval exceeds a year; reconsider the approach
    }
}

Prevention

When it happens

Trigger: A cron expression like '0 0 0 1 1/13 ?' where the increment after '/' in the month field is >= 13. The check at line 735 tests incr > 12 with type MONTH.

Common situations: Generating a month increment dynamically without clamping to the valid range, or misunderstanding the 1-12 month domain.

Related errors


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