jeecgboot/JeecgBoot · error · ParseException
Unexpected character '${c}' after '/'
Error message
Unexpected character '${c}' after '/' What it means
Thrown after the parser has read the first digit following '/' and then encounters a character that is not a digit at the next position. For multi-digit step values this is normal (the parser reads all consecutive digits), but if the character after the first step digit is a letter, special character, or delimiter that is not 0–9, the expression is malformed. Note: if the very first character after '/' is not a digit, Integer.parseInt on the prior line would throw an unchecked NumberFormatException instead — this error specifically fires when the first char IS a digit but a subsequent char is not.
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: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 96fb33f5ec)
Solutions
- Remove any non-numeric characters after the step value — the step must be a pure integer.
- Separate concerns: use either step ('/') or modifier ('L', 'W', '#') in a single token, not both after the same base value.
- Inspect the full field string character-by-character if built dynamically.
Example fix
// before String cron = "0/5W * * * * ?"; // 'W' after step value // after String cron = "0/5 * * * * ?"; // every 5 seconds
Defensive patterns
Strategy: validation
Validate before calling
// After '/', ensure only digits follow the step value until end or delimiter
for (String field : cronExpr.split("\\s+")) {
int slashIdx = field.indexOf('/');
if (slashIdx >= 0 && slashIdx + 1 < field.length()) {
String afterSlash = field.substring(slashIdx + 1);
for (char ch : afterSlash.toCharArray()) {
if (ch < '0' || ch > '9') {
throw new IllegalArgumentException("Unexpected character '" + ch + "' after '/'");
}
}
}
} Type guard
boolean isStepValuePureDigits(String field) {
int slashIdx = field.indexOf('/');
if (slashIdx < 0 || slashIdx + 1 >= field.length()) return true;
String step = field.substring(slashIdx + 1);
return step.chars().allMatch(c -> c >= '0' && c <= '9');
} Try / catch
try {
CronExpression cron = new CronExpression(expr);
} catch (ParseException e) {
if (e.getMessage().contains("Unexpected character") && e.getMessage().contains("after '/'")) {
// remove non-digit characters after the step value
}
throw e;
} Prevention
- Keep step values after '/' as pure integers with no modifiers.
- Do not combine step syntax with 'L', 'W', or '#' in the same token.
- Inspect dynamically assembled cron tokens for stray characters.
When it happens
Trigger: A cron field token like '0/5L' (letter after step), '0/5/' (second slash), '0/5-' (dash after step), or '0/5#' where the parser reads '5' as v2 then sees a non-digit. The token must have a digit immediately after '/', followed by a non-digit that is not whitespace or end-of-string.
Common situations: Developer combines step syntax with a modifier incorrectly (e.g., '1/5W'); malformed expression from string concatenation; trailing junk character appended to a valid step value.
Related errors
- Day-of-Week values must be between 1 and 7
- 'L' option is not valid here. (pos=${i})
- 'W' option is not valid here. (pos=${i})
- The 'W' option does not make sense with values larger than 3
- '#' option is not valid here. (pos=${i})
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/253afedcf40ef2c7.
Report an issue: GitHub.