jeecgboot/JeecgBoot · error · ParseException

Increment >= 31 : {incr}

Error message

Increment >= 31 : {incr}

What it means

checkIncrementRange rejects a step value greater than 31 for DAY_OF_MONTH (months have at most 31 days). A '/32' or larger step is invalid. Note the code uses '> 31' (i.e. 31 is allowed even though few months reach it). Message echoes the increment.

Source

Thrown at jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-xxljob/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java:732

                    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 96fb33f5ec)

Solutions

  1. Cap day-of-month steps at 31; common values are '/2', '/3', '/5'.
  2. For 'every N months' put the step in the MONTH field: '0 0 0 1 1/3 ?' = every 3 months on the 1st.
  3. Clamp computed dom steps to 1-31.

Example fix

// before - day-of-month step > 31
String cron = "0 0 0 1/40 * ?";  // Increment >= 31 : 40

// after - every 3 months on the 1st
String cron = "0 0 0 1 1/3 ?";
Defensive patterns

Strategy: validation

Validate before calling

// DAY_OF_MONTH step must be <= 31.
public static String validateDomStep(String domField) {
    return validateStepRange(domField, 31);
}
// (validateStepRange as defined in error 295)

Type guard

public static boolean domStepValid(String domField) {
    return stepWithinMax(domField, 31);
}

Try / catch

try {
    new CronExpression(expr);
} catch (ParseException e) {
    if (e.getMessage().startsWith("Increment >= 31")) {
        return "Day-of-month steps must be <= 31; for multi-month intervals use the month step. " + e.getMessage();
    }
    throw e;
}

Prevention

When it happens

Trigger: Day-of-month step out of range: '0 0 0 1/32 * ?', or a computed monthly interval > 31 placed in the dom field.

Common situations: Confusing dom step with month step (for 'every N months' use the MONTH field, not dom); dynamic interval generation without bounds; off-by-one around 31.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/8ec6fbd107ec41e3. Report an issue: GitHub.