{"record":{"id":"aae7e8d89f857a79","repo":"nats-io/nats-server","slug":"step-of-range-should-be-a-positive-number-s","errorCode":null,"errorMessage":"step of range should be a positive number: %s","messagePattern":"step of range should be a positive number: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cron.go","lineNumber":231,"sourceCode":"\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\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 {\n\t\t\treturn namedInt, nil\n\t\t}\n\t}\n\treturn mustParseInt(expr)\n}\n\n// mustParseInt parses the given expression as an int or returns an error.\nfunc mustParseInt(expr string) (uint, error) {\n\tnum, err := strconv.Atoi(expr)\n\tif err != nil {","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/cron.go#L213-L249","documentation":"getRange requires the '/' step of a cron range to be a positive integer; a step that parsed to 0 (or was explicitly '0') is rejected. Steps like '/0' produce this error rather than silently matching nothing.","triggerScenarios":"A cron field with a zero step, e.g. \"*/0\" or \"1-30/0\", parsed via parseCron -> getField -> getRange.","commonSituations":"Computing the step from a variable/config value that defaulted to 0; typo writing '/o' or '/0' intending a real interval.","solutions":["Set the step to a positive integer, e.g. \"*/5\" or \"1-30/2\"","Validate any programmatically-supplied step is >= 1 before building the schedule string","Remove the '/step' suffix entirely if every unit should match"],"exampleFix":"// before\n expr := \"*/0\"\n// after\n expr := \"*/1\"","handlingStrategy":"validation","validationCode":"if step := parseStep(seg); step == 0 {\n    return fmt.Errorf(\"step must be >= 1 in %q\", seg)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard programmatically-supplied steps with a >= 1 check","Prefer omitting the step when every unit should fire"],"tags":["cron","parsing","range-validation"],"backgroundTag":"invalid-cron-expression","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}