{"record":{"id":"9e01b55cc611ed7d","repo":"temporalio/temporal","slug":"s-has-too-many-slashes","errorCode":null,"errorMessage":"%s has too many slashes","messagePattern":"(.+?) has too many slashes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"service/worker/scheduler/calendar.go","lineNumber":427,"sourceCode":"//revive:disable-next-line:cognitive-complexity\nfunc makeRange(s, field, def string, minVal, maxVal int, parseMode parseMode) ([]*schedulepb.Range, error) {\n\ts = strings.TrimSpace(s)\n\tif s == \"\" {\n\t\ts = def\n\t}\n\tif s == \"*\" && parseMode == parseModeYear {\n\t\treturn nil, nil // special case for year: all is represented as empty range list\n\t}\n\tvar ranges []*schedulepb.Range\n\tfor part := range strings.SplitSeq(s, \",\") {\n\t\tvar err error\n\t\tstep := 1\n\t\thasStep := false\n\t\tslashes := strings.Count(part, \"/\")\n\t\tif slashes > 1 {\n\t\t\t// Inputs like \"3/5/7\" should yield the canonical \"too many slashes\" error\n\t\t\t// (instead of a later strconv parse error) so tests get consistent results.\n\t\t\treturn nil, fmt.Errorf(\"%s has too many slashes\", field)\n\t\t}\n\t\tif slashes == 1 {\n\t\t\t// A single slash introduces an integer step.\n\t\t\tskipParts := strings.SplitN(part, \"/\", 2)\n\t\t\t// Count==1 guarantees len==2; only need to ensure the right side is non-empty.\n\t\t\tif skipParts[1] == \"\" { // e.g. \"5/\"\n\t\t\t\treturn nil, fmt.Errorf(\"%s missing step value\", field)\n\t\t\t}\n\t\t\tpart = skipParts[0]\n\t\t\tstep, err = strconv.Atoi(skipParts[1])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif step < 1 {\n\t\t\t\treturn nil, fmt.Errorf(\"%s has invalid Step\", field)\n\t\t\t}\n\t\t\thasStep = true\n\t\t}","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/worker/scheduler/calendar.go#L409-L445","documentation":"MakeRange (cron/schedule spec parser in the scheduler package) rejects a comma-separated field part containing more than one '/', e.g. \"3/5/7\". Cron syntax allows at most one step value per part, so the parser returns this canonical error naming the field (e.g. \"Minute has too many slashes\").","triggerScenarios":"Calling schedule/cron parsing (used by Scheduler specs) with a spec field part like \"*/2/3\" or \"1-5/2/3\" — two or more '/' characters in one comma-separated part.","commonSituations":"Users copying cron expressions that double-apply step values, or concatenating \"x/y\" strings programmatically producing \"x/y/z\"; typos in scheduler calendar spec configuration.","solutions":["Fix the spec so each part has at most one step: e.g. \"3/5/7\" → \"3/7\" or \"*/5\".","Validate the cron/schedule string before submitting it to the scheduler API.","Check which field the error names (field prefix) to locate the offending part in the spec.","If you need both a range-step and another step, express them as separate comma-separated parts."],"exampleFix":"// before\nspec := \"3/5/7\" // Minute field\n// after\nspec := \"3/7\" // single step only","handlingStrategy":"validation","validationCode":"func validCronPart(part string) bool {\n    return strings.Count(part, \"/\") <= 1\n}\nif !validCronPart(minutePart) {\n    return errors.New(\"cron part may contain at most one '/'\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reject specs with more than one '/' per comma-separated part at your API boundary.","Use a cron expression linter in CI for scheduler configurations.","Never build step expressions by naive string concatenation of multiple 'x/y' fragments."],"tags":["go","scheduler","cron","validation","parsing"],"backgroundTag":"invalid-cron-spec","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}