{"record":{"id":"8da4ed3ef9c8cda3","repo":"gastownhall/beads","slug":"invalid-range-format-expected-start-end","errorCode":null,"errorMessage":"invalid range format: expected start..end","messagePattern":"invalid range format: expected start\\.\\.end","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/formula/range.go","lineNumber":357,"sourceCode":"\t\t}\n\t\tp.advance()\n\t\treturn val, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"unexpected token in expression\")\n\t}\n}\n\n// ValidateRange validates a range expression without evaluating it.\n// Useful for syntax checking during formula validation.\nfunc ValidateRange(expr string) error {\n\texpr = strings.TrimSpace(expr)\n\tif expr == \"\" {\n\t\treturn fmt.Errorf(\"empty range expression\")\n\t}\n\n\tm := rangePattern.FindStringSubmatch(expr)\n\tif m == nil {\n\t\treturn fmt.Errorf(\"invalid range format: expected start..end\")\n\t}\n\n\t// Check that expressions parse (with placeholder vars)\n\tplaceholderVars := make(map[string]string)\n\trangeVarPattern.ReplaceAllStringFunc(expr, func(match string) string {\n\t\tname := match[1 : len(match)-1]\n\t\tplaceholderVars[name] = \"1\" // Use 1 as placeholder\n\t\treturn \"1\"\n\t})\n\n\tstartExpr := strings.TrimSpace(m[1])\n\tstartExpr = substituteVars(startExpr, placeholderVars)\n\tif _, err := tokenize(startExpr); err != nil {\n\t\treturn fmt.Errorf(\"invalid start expression: %w\", err)\n\t}\n\n\tendExpr := strings.TrimSpace(m[2])\n\tendExpr = substituteVars(endExpr, placeholderVars)","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/formula/range.go#L339-L375","documentation":"ValidateRange matches the expression against rangePattern, which requires the 'start..end' form. If the regex does not match, the string is not a well-formed range and this error explains the expected format.","triggerScenarios":"ValidateRange with strings missing the '..' separator or having extra content, e.g. '1-10', '1 to 10', '1...10' (if the pattern disallows it), or a single value '10'.","commonSituations":"Users writing shell-style ranges ('1-10'), migration from other config formats, typos like '..' replaced with '--' or a single '.'.","solutions":["Rewrite the range using the 'start..end' syntax, e.g. '1..10'","Expressions are allowed on either side, e.g. '1..n*2' — verify the '..' separator is intact","Check for accidental character substitution (e.g. '1..10' typed as '1..10 ' is fine but '1 10' is not)"],"exampleFix":"// before\nValidateRange(\"1-10\")\n// after\nValidateRange(\"1..10\")","handlingStrategy":"validation","validationCode":"var rangeRe = regexp.MustCompile(`^\\s*[^\\.]+\\.\\.[^\\.]+\\s*$`)\nif !rangeRe.MatchString(expr) {\n    return fmt.Errorf(\"range must look like start..end, got %q\", expr)\n}","typeGuard":null,"tryCatchPattern":"if err := ValidateRange(expr); err != nil {\n    if strings.Contains(err.Error(), \"invalid range format\") {\n        // normalize separators (e.g. '1-10' -> '1..10') and retry\n    }\n}","preventionTips":["Document and enforce the 'start..end' syntax in user-facing config","Normalize common alternative separators before validation","Show an example range in error messages to users"],"tags":["formula","validation","range","syntax"],"backgroundTag":"invalid-range-format","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}