{"record":{"id":"4ba5e85168d2a6c7","repo":"robfig/cron","slug":"end-of-range-d-above-maximum-d-s","errorCode":null,"errorMessage":"end of range (%d) above maximum (%d): %s","messagePattern":"end of range \\((.+?)\\) above maximum \\((.+?)\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"parser.go","lineNumber":308,"sourceCode":"\t\t\treturn 0, err\n\t\t}\n\n\t\t// Special handling: \"N/step\" means \"N-max/step\".\n\t\tif singleDigit {\n\t\t\tend = r.max\n\t\t}\n\t\tif step > 1 {\n\t\t\textra = 0\n\t\t}\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"too many slashes: %s\", expr)\n\t}\n\n\tif start < r.min {\n\t\treturn 0, fmt.Errorf(\"beginning of range (%d) below minimum (%d): %s\", start, r.min, expr)\n\t}\n\tif end > r.max {\n\t\treturn 0, fmt.Errorf(\"end of range (%d) above maximum (%d): %s\", end, r.max, expr)\n\t}\n\tif start > end {\n\t\treturn 0, fmt.Errorf(\"beginning of range (%d) beyond end of range (%d): %s\", start, end, expr)\n\t}\n\tif step == 0 {\n\t\treturn 0, fmt.Errorf(\"step of range should be a positive number: %s\", expr)\n\t}\n\n\treturn getBits(start, end, step) | extra, nil\n}\n\n// parseIntOrName returns the (possibly-named) integer contained in expr.\nfunc parseIntOrName(expr string, names map[string]uint) (uint, error) {\n\tif names != nil {\n\t\tif namedInt, ok := names[strings.ToLower(expr)]; ok {\n\t\t\treturn namedInt, nil\n\t\t}\n\t}","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/robfig/cron/blob/bc59245fe10efaed9d51b56900192527ed733435/parser.go#L290-L326","documentation":"Thrown by getRange in parser.go when the end value of a cron field range exceeds the field's maximum. Each field has fixed bounds (e.g. seconds/minutes 0-59, hours 0-23, day-of-month 1-31, month 1-12, day-of-week 0-6), and getRange rejects ranges whose high end overflows them. This prevents silently wrapping or mis-scheduling values that don't exist in the field.","triggerScenarios":"Calling cron.Parse with a spec like '0 60 * * * *' (minute max 59), '0 0 24 * * *' (hour max 23), '0 0 0 1-32 * *' (dom max 31), '0 0 0 * 1-13 *' (month max 12), or '* * * * * 7-8' under standard dow bounds (max 6).","commonSituations":"Mistaking hours for a 0-24 range (some systems use 1-24); copying Quartz-style 7-for-Sunday dow values into this library where dow maxes at 6; template strings with placeholders replaced by unvalidated config values.","solutions":["Check the 'above maximum (%d)' value in the error and reduce the range end to the field's ceiling (seconds/minutes 59, hours 23, dom 31, month 12, dow 6)","Use '7' for Sunday? This library's dow is 0-6, so map 7 to 0","Validate spec strings from config/user input with cron.Parse at startup so bad values fail fast","Use '*' for the whole field instead of an explicit max range"],"exampleFix":"// before\ncron.Parse(\"0 0 0 * 1-12,13 *\") // month max is 12\n// after\ncron.Parse(\"0 0 0 * 1-12 *\")","handlingStrategy":"validation","validationCode":"var fieldMax = map[string]int{\"second\":59,\"minute\":59,\"hour\":23,\"dom\":31,\"month\":12,\"dow\":6}\nfunc validRangeEnd(end int, field string) bool { return end <= fieldMax[field] }","typeGuard":null,"tryCatchPattern":"sched, err := cron.Parse(spec)\nif err != nil {\n\treturn fmt.Errorf(\"invalid cron spec %q: %w\", spec, err)\n}","preventionTips":["Memorize the ceilings: seconds/minutes 59, hours 23, dom 31, month 12, dow 6","Map Quartz's dow 7 to 0 when porting specs","Validate specs from config at startup with a cron.Parse smoke test"],"tags":["cron","parser","range-validation","go"],"backgroundTag":"value-out-of-range","analyzedSha":"bc59245fe10efaed9d51b56900192527ed733435","analyzedAt":"2026-09-07T00:35:06.760Z","contentChangedAt":"2026-09-07T00:35:06.760Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}