temporalio/temporal · warning
%s has too many dashes
Error message
%s has too many dashes
What it means
In a cron field part that is not "*", at most one '-' (denoting a range like "1-5") is allowed because negative numbers are not valid in this spec. A part containing two or more dashes, e.g. "1-5-7", makes makeRange return this canonical error naming the field.
Source
Thrown at service/worker/scheduler/calendar.go:454
part = skipParts[0]
step, err = strconv.Atoi(skipParts[1])
if err != nil {
return nil, err
}
if step < 1 {
return nil, fmt.Errorf("%s has invalid Step", field)
}
hasStep = true
}
start, end := minVal, maxVal
if part != "*" {
if strings.Contains(part, "-") {
// 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.View on GitHub (pinned to bde624efd1)
Solutions
- Express multiple ranges/ranges+values as a comma-separated list: "1-5-7" → "1-5,7".
- Validate the cron expression before submission.
- Check the field name in the error to find the offending part.
- If the intent was an enumeration, use commas, not dashes.
Example fix
// before spec := "1-5-7" // after spec := "1-5,7"
Defensive patterns
Strategy: validation
Validate before calling
func validRangePart(part string) bool {
return strings.Count(part, "-") <= 1
}
if !validRangePart(dayPart) {
return errors.New("use commas to combine multiple ranges, e.g. 1-5,7")
} Prevention
- Teach users that multiple ranges are comma-separated, not dash-chained.
- Validate each comma-separated cron part against ^\*?([^-]+(-[^-]+)?)(/\d+)?$ style patterns.
- Add parsing tests covering '1-5-7' style inputs to fail fast at config load.
When it happens
Trigger: A spec field part like "1-5-7" or "MON-WED-FRI" in the day-of-week field is passed to schedule parsing.
Common situations: Users chaining multiple ranges with dashes instead of commas (correct form: "1-5,7"); copy-paste errors; confusion with other cron dialects that support lists differently.
Related errors
- %s has too many slashes
- %s missing step value
- CronString has time zone but missing fields
- CronString does not have 5-7 fields
- CronString does not have interval after @every
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/408aca55a7b60f71.
Report an issue: GitHub.