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
- Replace the non-numeric character after '/' with a valid integer (e.g., '1-5/2').
- Remove the '/' and its trailing content if no step is needed.
- 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
- Ensure only digits follow '/' in any cron field.
- Sanitize cron input to strip non-numeric characters after '/'.
- Use a cron builder API instead of raw string concatenation for complex expressions.
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
- '/' must be followed by an integer.
- Unexpected end of string.
- Unexpected character: {}
- Increment >= 60 : {}
- Increment >= 24 : {}
AI-assisted analysis of xuxueli/xxl-job@e74c784f68 (2026-08-14).
Data as JSON: /api/errors/64565621373d7157.
Report an issue: GitHub.