{"record":{"id":"4cc92e2ffbfb6ba3","repo":"temporalio/temporal","slug":"s-start-is-not-in-range-d-d","errorCode":null,"errorMessage":"%s Start is not in range [%d-%d]","messagePattern":"(.+?) Start is not in range \\[(.+?)-(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/worker/scheduler/calendar.go","lineNumber":461,"sourceCode":"\t\t\t}\n\t\t\thasStep = true\n\t\t}\n\n\t\tstart, end := minVal, maxVal\n\t\tif part != \"*\" {\n\t\t\tif strings.Contains(part, \"-\") {\n\t\t\t\t// Only a single dash is allowed to denote a range (e.g. \"1-5\").\n\t\t\t\t// Inputs with multiple dashes like \"1-5-7\" should raise the\n\t\t\t\t// canonical \"too many dashes\" error expected by tests.\n\t\t\t\tif strings.Count(part, \"-\") > 1 { // no negative numbers are expected in spec\n\t\t\t\t\treturn nil, fmt.Errorf(\"%s has too many dashes\", field)\n\t\t\t\t}\n\t\t\t\trangeParts := strings.SplitN(part, \"-\", 2)\n\t\t\t\tif len(rangeParts) != 2 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%s has too many dashes\", field)\n\t\t\t\t}\n\t\t\t\tif start, err = parseValue(rangeParts[0], minVal, maxVal, parseMode); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%s Start is not in range [%d-%d]\", field, minVal, maxVal)\n\t\t\t\t}\n\t\t\t\tif end, err = parseValue(rangeParts[1], start, maxVal, parseMode); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%s End is before Start or not in range [%d-%d]\", field, minVal, maxVal)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif start, err = parseValue(part, minVal, maxVal, parseMode); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%s is not in range [%d-%d]\", field, minVal, maxVal)\n\t\t\t\t}\n\t\t\t\tif !hasStep {\n\t\t\t\t\t// if / is present, a single value is treated as that value to the\n\t\t\t\t\t// end. otherwise a single value is just the single value.\n\t\t\t\t\tend = start\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Special handling for Sunday: Turn \"7\" into \"0\", which may require an extra range.\n\t\t// Consider some cases:\n\t\t// 0-7 or 1-7   can turn into 0-6","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/worker/scheduler/calendar.go#L443-L479","documentation":"makeRange parses one cron-style field (e.g. day-of-week) into a numeric range. When the part contains a dash (a range like '5-10'), parseValue validates the start against [minVal,maxVal]; if it fails (out-of-range value, or a value that fails the field's parse mode, e.g. non-numeric text where a name is not allowed), this error is returned naming the field and allowed bounds.","triggerScenarios":"Calling makeRange (via calendar spec parsing in a Scheduler/CalendarSpec workflow) with a range expression whose start bound is invalid, e.g. 'mon-sun' where month names are not accepted for that field, '60-70' for a minutes field (0-59), or a negative/out-of-bounds number like '99-100'.","commonSituations":"Hand-written cron-like schedule strings with typos; copying a cron expression between fields with different bounds (hour vs day-of-month); using textual names (MON, JAN) in fields that only accept numbers under the current parse mode.","solutions":["Check the start value of the range is within the printed [min-max] bounds for that field and fix it","If using textual names, switch to a spec type that accepts names (e.g. CalendarSpec dayOfWeek strings) or use numeric values","Catch the error and surface it as a user-facing schedule-validation message before creating the Schedule"],"exampleFix":"// before\ncalendar := &schedule.CalendarSpec{Hour: \"25-30\"}\n// after\ncalendar := &schedule.CalendarSpec{Hour: \"0-23\"}","handlingStrategy":"validation","validationCode":"func validCronRangeStart(part string, min, max int) error {\n    i := strings.Index(part, \"-\")\n    if i <= 0 { return nil }\n    v, err := strconv.Atoi(part[:i])\n    if err != nil || v < min || v > max {\n        return fmt.Errorf(\"range start %q must be %d-%d\", part[:i], min, max)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use schedule.Spec structs with typed ints rather than hand-written cron strings","Test schedule parsing in unit tests before deploying schedule definitions","Keep each field's documented min/max bounds at hand when writing ranges"],"tags":["scheduler","cron-parsing","validation","go"],"backgroundTag":"schedule-field-out-of-range","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}