jeecgboot/JeecgBoot · error · ParseException

'/' must be followed by an integer.

Error message

'/' must be followed by an integer.

What it means

When the current char is '/', the parser checks whether the next char exists and is not whitespace. If '/' is at the end of the string or immediately followed by a space/tab, there is no increment value, so this is thrown. The '/' step operator must always be followed by an integer (e.g. '0/15' = every 15 starting at 0).

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:643

                if (!daysOfMonth.isEmpty() && daysOfMonth.last() == NO_SPEC_INT) {
                    throw new ParseException(
                            "'?' can only be specified for Day-of-Month -OR- Day-of-Week.",
                            i);
                }
            }

            addToSet(NO_SPEC_INT, -1, 0, type);
            return i;
        }

        if (c == '*' || c == '/') {
            if (c == '*' && (i + 1) >= s.length()) {
                addToSet(ALL_SPEC_INT, -1, incr, type);
                return i + 1;
            } else if (c == '/'
                    && ((i + 1) >= s.length() || s.charAt(i + 1) == ' ' || s
                    .charAt(i + 1) == '\t')) {
                throw new ParseException("'/' must be followed by an integer.", i);
            } else if (c == '*') {
                i++;
            }
            c = s.charAt(i);
            if (c == '/') { // is an increment specified?
                i++;
                if (i >= s.length()) {
                    throw new ParseException("Unexpected end of string.", i);
                }

                incr = getNumericValue(s, i);

                i++;
                if (incr > 10) {
                    i++;
                }
                checkIncrementRange(incr, type, i);
            } else {

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Always follow '/' with a positive integer: '0/15', '*/5', '10-30/2'.
  2. If you only wanted 'every value', drop the slash entirely and use '*'.
  3. When generating 'start/step' strings, never emit the slash unless the step is non-empty.

Example fix

// before - dangling '/' with no increment
String cron = "0 0 0/ * * ?";  // '/' must be followed by an integer

// after - supply an increment (every 2 hours)
String cron = "0 0 0/2 * * ?";
Defensive patterns

Strategy: validation

Validate before calling

// Every '/' in a field must be followed by a non-whitespace integer.
public static String validateStepOperator(String field) {
    if (field == null) return null;
    int slash = field.indexOf('/');
    if (slash < 0) return null;
    if (slash == field.length() - 1) return "'/' at end of field with no increment";
    String rest = field.substring(slash + 1);
    if (rest.isEmpty() || rest.startsWith(" ") || rest.startsWith("\t")) {
        return "'/' must be followed by an integer: " + field;
    }
    return null;
}

Type guard

public static boolean stepHasIntegerOperand(String field) {
    if (field == null || !field.contains("/")) return true;
    int slash = field.indexOf('/');
    return slash < field.length() - 1
        && field.substring(slash + 1).matches("[0-9]+.*");
}

Try / catch

try {
    new CronExpression(expr);
} catch (ParseException e) {
    if (e.getMessage().startsWith("'/' must be followed")) {
        return "Add an integer after each '/'. " + e.getMessage();
    }
    throw e;
}

Prevention

When it happens

Trigger: Trailing '/' with no operand: '0 0 0/ * * ?', '0 0 0 0/ * * ?' where the '/' is the last meaningful char, or '*/ ' with a space after the slash. Also '0 0 0 5/ * * ?' (space after slash).

Common situations: Truncated pasted expression where the step value was cut off; typo leaving the slash dangling; building a step expression with an empty increment variable.

Related errors


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