{"record":{"id":"4b6365d84d268e13","repo":"xuxueli/xxl-job","slug":"must-be-followed-by-an-integer","errorCode":null,"errorMessage":"'/' must be followed by an integer.","messagePattern":"'/' must be followed by an integer\\.","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"xxl-job-admin/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java","lineNumber":643,"sourceCode":"                if (!daysOfMonth.isEmpty() && daysOfMonth.last() == NO_SPEC_INT) {\n                    throw new ParseException(\n                            \"'?' can only be specified for Day-of-Month -OR- Day-of-Week.\",\n                            i);\n                }\n            }\n\n            addToSet(NO_SPEC_INT, -1, 0, type);\n            return i;\n        }\n\n        if (c == '*' || c == '/') {\n            if (c == '*' && (i + 1) >= s.length()) {\n                addToSet(ALL_SPEC_INT, -1, incr, type);\n                return i + 1;\n            } else if (c == '/'\n                    && ((i + 1) >= s.length() || s.charAt(i + 1) == ' ' || s\n                    .charAt(i + 1) == '\\t')) {\n                throw new ParseException(\"'/' must be followed by an integer.\", i);\n            } else if (c == '*') {\n                i++;\n            }\n            c = s.charAt(i);\n            if (c == '/') { // is an increment specified?\n                i++;\n                if (i >= s.length()) {\n                    throw new ParseException(\"Unexpected end of string.\", i);\n                }\n\n                incr = getNumericValue(s, i);\n\n                i++;\n                if (incr > 10) {\n                    i++;\n                }\n                checkIncrementRange(incr, type, i);\n            } else {","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/xuxueli/xxl-job/blob/e74c784f68f81fa89cb350913ef15794865d7b12/xxl-job-admin/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java#L625-L661","documentation":"This error occurs when the parser encounters a '/' character that is not followed by a valid increment integer — specifically when '/' is at the end of the field, or followed by a space/tab. In cron syntax, '/' specifies a step/increment value (e.g., '*/5'), and it must be followed by a number.","triggerScenarios":"A cron field ending with '/' such as '*/' (string ends immediately after '/'), or '*/ ' where '/' is followed by whitespace. The parser checks (i+1) >= s.length() or s.charAt(i+1) is space/tab right after the '/' in the '*' or '/' handling branch.","commonSituations":"Truncated cron string from user input or a template that was incompletely filled, or a copy-paste that dropped the trailing increment digit.","solutions":["Add a valid integer after the '/' (e.g., '*/5' instead of '*/').","Remove the '/' if no increment is intended (use '*' alone).","Validate the cron string with a regex or cron validator before passing it to the constructor."],"exampleFix":"// before\n\"*/ * * * * ?\"\n// after\n\"*/5 * * * * ?\"","handlingStrategy":"validation","validationCode":"// Reject fields where '/' is not followed by a digit\nfor (String field : cron.trim().split(\"\\\\s+\")) {\n    int slash = field.indexOf('/');\n    if (slash != -1 && (slash + 1 >= field.length() || !Character.isDigit(field.charAt(slash + 1)))) {\n        throw new IllegalArgumentException(\"'/' must be followed by an integer in: \" + field);\n    }\n}","typeGuard":"boolean hasValidStep(String field) {\n    int i = field.indexOf('/');\n    return i == -1 || (i + 1 < field.length() && Character.isDigit(field.charAt(i + 1)));","tryCatchPattern":"try {\n    new CronExpression(cron);\n} catch (ParseException e) {\n    if (e.getMessage().contains(\"'/' must be followed by an integer\")) {\n        // prompt user for a valid step value\n    }\n}","preventionTips":["Never end a cron field with '/'; always append a step integer.","When building cron strings programmatically, guard against empty increment segments.","Use a cron validator utility before persisting user-supplied expressions."],"tags":["cron","validation","syntax"],"backgroundTag":null,"analyzedSha":"e74c784f68f81fa89cb350913ef15794865d7b12","analyzedAt":"2026-08-14T04:22:43.715Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}