{"record":{"id":"0eb695178053ef74","repo":"alibaba/spring-cloud-alibaba","slug":"increment-31","errorCode":null,"errorMessage":"Increment > 31 : {}","messagePattern":"Increment > 31 : (.+?)","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-schedulerx/src/main/java/com/alibaba/cloud/scheduling/schedulerx/util/CronExpression.java","lineNumber":442,"sourceCode":"\t\t\t\ti++;\n\t\t\t\tif (i >= s.length()) {\n\t\t\t\t\tthrow new ParseException(\"Unexpected end of string.\", i);\n\t\t\t\t}\n\n\t\t\t\tincr = getNumericValue(s, i);\n\n\t\t\t\ti++;\n\t\t\t\tif (incr > 10) {\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\tif (incr > 59 && (type == SECOND || type == MINUTE)) {\n\t\t\t\t\tthrow new ParseException(\"Increment > 60 : \" + incr, i);\n\t\t\t\t}\n\t\t\t\telse if (incr > 23 && (type == HOUR)) {\n\t\t\t\t\tthrow new ParseException(\"Increment > 24 : \" + incr, i);\n\t\t\t\t}\n\t\t\t\telse if (incr > 31 && (type == DAY_OF_MONTH)) {\n\t\t\t\t\tthrow new ParseException(\"Increment > 31 : \" + incr, i);\n\t\t\t\t}\n\t\t\t\telse if (incr > 7 && (type == DAY_OF_WEEK)) {\n\t\t\t\t\tthrow new ParseException(\"Increment > 7 : \" + incr, i);\n\t\t\t\t}\n\t\t\t\telse if (incr > 12 && (type == MONTH)) {\n\t\t\t\t\tthrow new ParseException(\"Increment > 12 : \" + incr, i);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tincr = 1;\n\t\t\t}\n\n\t\t\taddToSet(ALL_SPEC_INT, -1, incr, type);\n\t\t\treturn i;\n\t\t}\n\t\telse if (c == 'L') {\n\t\t\ti++;\n\t\t\tif (type == DAY_OF_MONTH) {","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/alibaba/spring-cloud-alibaba/blob/115d5901102009492e05d5ec18c3f79cad4077d0/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-schedulerx/src/main/java/com/alibaba/cloud/scheduling/schedulerx/util/CronExpression.java#L424-L460","documentation":"Thrown when a step value after '/' exceeds 31 in the DAY_OF_MONTH field (guard at CronExpression.java:441-442). Day-of-month steps are capped at 31 because no month has more days.","triggerScenarios":"`new CronExpression(\"0 0 0 */32 * ?\")` (day-of-month step 32) or any step > 31 in the day-of-month position.","commonSituations":"Developer intends 'last few days' logic or copies a step from another field. A field-count error (missing seconds) is a frequent root cause, placing a large step into day-of-month.","solutions":["Use a day-of-month step <= 31, e.g. '*/32' -> '*/15'.","For end-of-month behavior, prefer the 'L' or 'L-N' construct instead of a large step.","Verify all six fields are present so the step sits in the intended field."],"exampleFix":"// before\nnew CronExpression(\"0 0 0 */32 * ?\");\n// after\nnew CronExpression(\"0 0 0 */15 * ?\"); // every 15 days","handlingStrategy":"validation","validationCode":"static boolean stepWithin(String field, int max) {\n    int slash = field.indexOf('/');\n    if (slash < 0) return true;\n    try { return Integer.parseInt(field.substring(slash + 1)) <= max; }\n    catch (NumberFormatException e) { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n    CronExpression cron = new CronExpression(raw);\n} catch (ParseException e) {\n    throw new IllegalArgumentException(\"Invalid cron expression: \" + raw, e);\n}","preventionTips":["Day-of-month steps cap at 31; use 'L' or 'L-N' for end-of-month needs.","Range-check injected step values before formatting.","Verify field ordering so the step targets day-of-month intentionally."],"tags":["cron","schedulerx","spring-cloud-alibaba","configuration","parsing","validation","range-check"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}