temporalio/temporal · error
%s is not in range [%d-%d]
Error message
%s is not in range [%d-%d]
What it means
makeRange parses a single value (no dash) for a calendar field via parseValue(part, minVal, maxVal, parseMode). Failure produces this error naming the field and bounds. Invalid tokens include out-of-range numbers and, depending on parse mode, unrecognized names like 'MON' or wildcards in a value position.
Source
Thrown at service/worker/scheduler/calendar.go:468
// Only a single dash is allowed to denote a range (e.g. "1-5").
// Inputs with multiple dashes like "1-5-7" should raise the
// canonical "too many dashes" error expected by tests.
if strings.Count(part, "-") > 1 { // no negative numbers are expected in spec
return nil, fmt.Errorf("%s has too many dashes", field)
}
rangeParts := strings.SplitN(part, "-", 2)
if len(rangeParts) != 2 {
return nil, fmt.Errorf("%s has too many dashes", field)
}
if start, err = parseValue(rangeParts[0], minVal, maxVal, parseMode); err != nil {
return nil, fmt.Errorf("%s Start is not in range [%d-%d]", field, minVal, maxVal)
}
if end, err = parseValue(rangeParts[1], start, maxVal, parseMode); err != nil {
return nil, fmt.Errorf("%s End is before Start or not in range [%d-%d]", field, minVal, maxVal)
}
} else {
if start, err = parseValue(part, minVal, maxVal, parseMode); err != nil {
return nil, fmt.Errorf("%s is not in range [%d-%d]", field, minVal, maxVal)
}
if !hasStep {
// if / is present, a single value is treated as that value to the
// end. otherwise a single value is just the single value.
end = start
}
}
}
// Special handling for Sunday: Turn "7" into "0", which may require an extra range.
// Consider some cases:
// 0-7 or 1-7 can turn into 0-6
// 3-7 has to turn into 0,3-6
// 3-7/3 can turn into 3-6/3 (7 doesn't match)
// 1-7/2 has to turn into 0,1-6/2
// That is, we can use a single range and just turn the 7 into a 6 only if step == 1
// and start == 0 or 1. Or if 7 isn't actually included. In other cases, we can add a
// 0, and then turn the 7 into a 6 in whatever the original range was. If the original
// range was just 7-7, then we're done.View on GitHub (pinned to bde624efd1)
Solutions
- Correct the single value to lie within the printed [min-max] range for the field
- Check name conventions (use the field's documented naming, e.g. CalendarSpec accepts 'MON')
- Use structured schedule.Spec types (ints) instead of strings to get compile/type-time safety
Example fix
// before
spec := &schedule.CalendarSpec{Minute: "61"}
// after
spec := &schedule.CalendarSpec{Minute: "59"} Defensive patterns
Strategy: validation
Validate before calling
func validCronValue(v string, min, max int) error {
n, err := strconv.Atoi(v)
if err != nil || n < min || n > max {
return fmt.Errorf("value %q must be %d-%d", v, min, max)
}
return nil
} Prevention
- Prefer typed schedule types (CalendarSpec with ints or ScheduleSpec SecondCronString only for well-formed cron)
- Watch for cron convention differences (0-6 vs 1-7 day-of-week) when porting expressions
- Add unit tests covering every field's boundary values
When it happens
Trigger: A Schedule's CalendarSpec/RangesSpec field set to an invalid single value, e.g. Minute: "61", DayOfWeek: "7" where 0-6 is expected, or an unparseable token.
Common situations: Off-by-one mistakes (day-of-month 32, hour 24); mixing cron 0-6 vs 1-7 day-of-week conventions; passing empty strings or '*' where a concrete value is required.
Related errors
- %s Start is not in range [%d-%d]
- %s End is before Start or not in range [%d-%d]
- out of range
- conflicting timezone names
- ${errs}
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/0c6d33857e772f63.
Report an issue: GitHub.