xuxueli/xxl-job · error · ParseException

Unexpected character '{}' after '/'

Error message

Unexpected character '{}' after '/'

What it means

In checkNext, after a '/' step modifier within a range expression, the character immediately following '/' must be a digit (0-9). If it is any other character (letter, symbol, etc.), this error fires. This catches malformed step values that are not integers.

Source

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

            i++;
            c = s.charAt(i);
            int v2 = Integer.parseInt(String.valueOf(c));
            i++;
            if (i >= s.length()) {
                checkIncrementRange(v2, type, i);
                addToSet(val, end, v2, type);
                return i;
            }
            c = s.charAt(i);
            if (c >= '0' && c <= '9') {
                ValueSet vs = getValue(v2, s, i);
                int v3 = vs.value;
                checkIncrementRange(v3, type, i);
                addToSet(val, end, v3, type);
                i = vs.pos;
                return i;
            } else {
                throw new ParseException("Unexpected character '" + c + "' after '/'", i);
            }
        }

        addToSet(val, end, 0, type);
        i++;
        return i;
    }

    public String getCronExpression() {
        return cronExpression;
    }

    public String getExpressionSummary() {
        StringBuilder buf = new StringBuilder();

        buf.append("seconds: ");
        buf.append(getExpressionSetSummary(seconds));
        buf.append("\n");

View on GitHub (pinned to e74c784f68)

Solutions

  1. Replace the non-numeric character after '/' with a valid integer (e.g., '1-5/2').
  2. Remove the '/' and its trailing content if no step is needed.
  3. Sanitize cron input to ensure only digits follow '/' characters.

Example fix

// before
"0 0 0 1-5/x * ?"
// after
"0 0 0 1-5/2 * ?"
Defensive patterns

Strategy: validation

Validate before calling

// After '/' in a range-step, the next char must be a digit
for (String field : cron.trim().split("\\s+")) {
    for (int j = 0; j < field.length(); j++) {
        if (field.charAt(j) == '/' && j + 1 < field.length() && !Character.isDigit(field.charAt(j + 1))) {
            throw new IllegalArgumentException("Non-numeric character after '/' in: " + field);
        }
    }
}

Type guard

boolean stepFollowedByDigit(String field) {
    for (int j = 0; j < field.length(); j++) {
        if (field.charAt(j) == '/' && j + 1 < field.length() && !Character.isDigit(field.charAt(j + 1))) return false;
    }
    return true;

Try / catch

try {
    new CronExpression(cron);
} catch (ParseException e) {
    if (e.getMessage().contains("Unexpected character") && e.getMessage().contains("after '/'")) {
        // replace the non-numeric char with a valid step integer
    }
}

Prevention

When it happens

Trigger: A cron expression like '0 0 0 1-5/x * ?' where 'x' follows '/' instead of a digit. The check at line 864 tests c >= '0' && c <= '9'; the else branch throws.

Common situations: Typo or copy-paste introducing a non-numeric character after '/', or a cron builder that inserts a variable name instead of a number.

Related errors


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