alibaba/spring-cloud-alibaba · error · ParseException
Unexpected character '{c}' after '/'
Error message
Unexpected character '{c}' after '/' What it means
Thrown in checkNext after a step '/' when the character following '/' is not a digit (guard at CronExpression.java:639-640). This branch handles steps that appear after a value or a range (e.g. '1-5/x' or '0/x'); a non-digit step is invalid.
Source
Thrown at spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-schedulerx/src/main/java/com/alibaba/cloud/scheduling/schedulerx/util/CronExpression.java:640
if (c == '/') {
i++;
c = s.charAt(i);
final int v2 = Integer.parseInt(String.valueOf(c));
i++;
if (i >= s.length()) {
addToSet(val, end, v2, type);
return i;
}
c = s.charAt(i);
if (c >= '0' && c <= '9') {
final ValueSet vs = getValue(v2, s, i);
final int v3 = vs.value;
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() {
final StringBuilder buf = new StringBuilder();
buf.append("seconds: ");
buf.append(getExpressionSetSummary(seconds));
buf.append("\n");View on GitHub (pinned to 115d590110)
Solutions
- Place a digit immediately after '/', e.g. '1-5/x' -> '1-5/2'.
- Remove the '/' if no step is intended (e.g. '0' alone).
- Range-check any templated step value.
Example fix
// before
new CronExpression("0 0 0 1-5/x * ?");
// after
new CronExpression("0 0 0 1-5/2 * ?"); // days 1-5 every 2 days Defensive patterns
Strategy: validation
Validate before calling
// A '/' must be followed by a digit anywhere in a field.
static boolean allStepsAreNumeric(String cron) {
if (cron == null) return true;
for (String f : cron.trim().split("\\s+")) {
for (int i = 0; i < f.length(); i++) {
if (f.charAt(i) == '/' && (i + 1 >= f.length() || !Character.isDigit(f.charAt(i + 1))))
return false;
}
}
return true;
} Try / catch
try {
CronExpression cron = new CronExpression(raw);
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid cron expression: " + raw, e);
} Prevention
- Every '/' must be immediately followed by a digit.
- Omit '/' if no step is needed.
- Validate templated step values before formatting.
When it happens
Trigger: `new CronExpression("0 0 0 1-5/x * ?")` ('x' after '/'), or `0 0 0 0/L * ?`, or any '<value>/<non-digit>'.
Common situations: Typo in the step value, a placeholder left as a letter, or a copy-paste that introduced an operator after '/' instead of a number.
Related errors
- '/' must be followed by an integer.
- Unexpected end of string.
- Increment > 60 : {}
- Increment > 24 : {}
- Increment > 31 : {}
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/6015c94434ae0b95.
Report an issue: GitHub.