{"record":{"id":"a79cc2084a9a720c","repo":"robfig/cron","slug":"beginning-of-range-d-below-minimum-d-s","errorCode":null,"errorMessage":"beginning of range (%d) below minimum (%d): %s","messagePattern":"beginning of range \\((.+?)\\) below minimum \\((.+?)\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"parser.go","lineNumber":305,"sourceCode":"\tcase 2:\n\t\tstep, err = mustParseInt(rangeAndStep[1])\n\t\tif err != nil {\n\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 {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/robfig/cron/blob/bc59245fe10efaed9d51b56900192527ed733435/parser.go#L287-L323","documentation":"Thrown by getRange in parser.go when the start value of a cron field range is below the field's minimum. Each cron field (second, minute, hour, dom, month, dow) has a bounds struct with a min/max, and getRange validates the parsed range against those bounds before building the bit set. E.g. a range starting at 0 in the day-of-month or month field (both 1-based) fails because their minimum is 1.","triggerScenarios":"Calling cron.Parse with a spec where a range's start is below the field minimum: '0-5 0 0 0 1 *' or '0 0 0 0-5 * *' (dom min is 1), '* * * * 0-11 *' is fine but '0 0 0 * 0 *' (month min is 1) fails. Any schedule string like 'X-Y/step' where X < field min.","commonSituations":"Copy-pasting 0-based values into 1-based fields (month, day-of-month) from programming contexts where month indexes start at 0; hand-editing crontab entries; generating specs programmatically with an off-by-one loop starting at 0.","solutions":["Read the error's 'below minimum (%d)' value to see the field's floor (e.g. 1 for month/dom) and change the range start to that minimum or higher","Use '*' or '?' instead of an explicit range when you mean the full field","If generating specs in code, clamp the range start to the field's bounds before formatting the string","Remember this library's month and day-of-month fields are 1-based, unlike some 0-based APIs"],"exampleFix":"// before\ncron.Parse(\"0 0 0 0-15 * *\") // dom min is 1\n// after\ncron.Parse(\"0 0 0 1-15 * *\")","handlingStrategy":"validation","validationCode":"func validRangeStart(start, fieldMin int) bool { return start >= fieldMin }\n// e.g. month/dom are 1-based: check start >= 1 before building \"start-end\" strings","typeGuard":null,"tryCatchPattern":"sched, err := cron.Parse(spec)\nif err != nil {\n\treturn fmt.Errorf(\"invalid cron spec %q: %w\", spec, err)\n}","preventionTips":["Remember month and day-of-month are 1-based in this library","Prefer '*' over explicit ranges that touch the field boundary","Clamp programmatically generated range starts to field bounds"],"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"}