{"record":{"id":"0971d06ccf221107","repo":"xuxueli/xxl-job","slug":"increment-31","errorCode":null,"errorMessage":"Increment >= 31 : {}","messagePattern":"Increment >= 31 : (.+?)","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":732,"sourceCode":"                    i = vs.pos;\n                }\n                i = checkNext(i, s, val, type);\n                return i;\n            }\n        } else {\n            throw new ParseException(\"Unexpected character: \" + c, i);\n        }\n\n        return i;\n    }\n\n    private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {\n        if (incr > 59 && (type == SECOND || type == MINUTE)) {\n            throw new ParseException(\"Increment >= 60 : \" + incr, idxPos);\n        } else if (incr > 23 && (type == HOUR)) {\n            throw new ParseException(\"Increment >= 24 : \" + incr, idxPos);\n        } else if (incr > 31 && (type == DAY_OF_MONTH)) {\n            throw new ParseException(\"Increment >= 31 : \" + incr, idxPos);\n        } else if (incr > 7 && (type == DAY_OF_WEEK)) {\n            throw new ParseException(\"Increment >= 7 : \" + incr, idxPos);\n        } else if (incr > 12 && (type == MONTH)) {\n            throw new ParseException(\"Increment >= 12 : \" + incr, idxPos);\n        }\n    }\n\n    protected int checkNext(int pos, String s, int val, int type)\n            throws ParseException {\n\n        int end = -1;\n        int i = pos;\n\n        if (i >= s.length()) {\n            addToSet(val, end, -1, type);\n            return i;\n        }\n","sourceCodeStart":714,"sourceCodeEnd":750,"githubUrl":"https://github.com/xuxueli/xxl-job/blob/e74c784f68f81fa89cb350913ef15794865d7b12/xxl-job-admin/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java#L714-L750","documentation":"Thrown by checkIncrementRange when a step/increment value in the Day-of-Month field exceeds 31. Since months have at most 31 days, an increment of 32 or more is rejected.","triggerScenarios":"A cron expression like '0 0 0 1/32 * ?' where the increment after '/' in the day-of-month field is >= 32. The check at line 731 tests incr > 31 with type DAY_OF_MONTH.","commonSituations":"Generating a day-of-month increment dynamically without bounds checking, or confusing the day-of-month maximum with another field's.","solutions":["Reduce the day-of-month increment to 31 or less.","For intervals longer than a month, use the month field.","Validate step values against 31 for the day-of-month field before building the expression."],"exampleFix":"// before\n\"0 0 0 1/45 * ?\"\n// after\n\"0 0 0 1/15 * ?\"","handlingStrategy":"validation","validationCode":"// Validate step increment for day-of-month (field index 3)\nString[] parts = cron.trim().split(\"\\\\s+\");\nif (parts.length > 3 && parts[3].contains(\"/\")) {\n    int step = Integer.parseInt(parts[3].substring(parts[3].indexOf(\"/\") + 1));\n    if (step > 31) throw new IllegalArgumentException(\"Day-of-month step must be <= 31: \" + step);\n}","typeGuard":"boolean isValidDayOfMonthStep(String domField) {\n    if (!domField.contains(\"/\")) return true;\n    int step = Integer.parseInt(domField.substring(domField.indexOf(\"/\") + 1));\n    return step >= 1 && step <= 31;","tryCatchPattern":"try {\n    new CronExpression(cron);\n} catch (ParseException e) {\n    if (e.getMessage().contains(\"Increment >= 31\")) {\n        // switch to month-based scheduling\n    }\n}","preventionTips":["Clamp day-of-month step values to 1-31 before building the expression.","For intervals longer than a month, use the month field.","Validate increments against each field's domain maximum."],"tags":["cron","validation","increment","range"],"backgroundTag":null,"analyzedSha":"e74c784f68f81fa89cb350913ef15794865d7b12","analyzedAt":"2026-08-14T04:22:43.715Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}