{"record":{"id":"bfd278df8393df26","repo":"juicedata/juicefs","slug":"invalid-range-q","errorCode":null,"errorMessage":"invalid range %q","messagePattern":"invalid range %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/vfs/fill.go","lineNumber":227,"sourceCode":"\t}\n\tlogger.Infof(\"%s %d paths in %s\", action, len(paths), time.Since(start))\n}\n\nfunc sendFile(ctx meta.Context, todo chan _file, f _file) error {\n\tselect {\n\tcase todo <- f:\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}\n\nfunc parseRanges(spec string) ([]ByteRange, error) {\n\tvar ranges []ByteRange\n\tfor _, part := range strings.Split(spec, \";\") {\n\t\tsep := strings.IndexByte(part, '-')\n\t\tif sep < 0 {\n\t\t\treturn nil, fmt.Errorf(\"invalid range %q\", part)\n\t\t}\n\t\tstart, err := strconv.ParseUint(part[:sep], 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid range %q: %w\", part, err)\n\t\t}\n\t\tend, err := strconv.ParseUint(part[sep+1:], 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid range %q: %w\", part, err)\n\t\t}\n\t\tif end <= start {\n\t\t\treturn nil, fmt.Errorf(\"invalid range %q: end must be greater than start\", part)\n\t\t}\n\t\tranges = append(ranges, ByteRange{Start: start, End: end})\n\t}\n\tsort.Slice(ranges, func(i, j int) bool { return ranges[i].Start < ranges[j].Start })\n\tmerged := ranges[:0]\n\tfor _, r := range ranges {\n\t\tif n := len(merged); n > 0 && r.Start <= merged[n-1].End {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/vfs/fill.go#L209-L245","documentation":"parseRanges parses a semicolon-separated 'start-end' byte range spec used for cache prefill targeting; a part lacking the '-' separator yields 'invalid range %q'. It is a spec-format validation error before any numeric parsing.","triggerScenarios":"Calling SplitTarget (or the range-fill feature) with a target string where any ';'-separated part has no dash, e.g. '0-100;200300' or a stray token.","commonSituations":"Hand-written --sub-dir/prefill range specs; typos like comma or space instead of dash; copied specs with wrong separators.","solutions":["Use 'start-end' with a hyphen for every part, joined by ';' e.g. '0-104857600;104857600-209715200'","Check for stray characters (commas, spaces) in the spec","Validate the spec with TestParseRangesMerge-style parsing before deploying"],"exampleFix":"// before\nspec := \"0-100,200-300\"\n// after\nspec := \"0-100;200-300\"","handlingStrategy":"validation","validationCode":"for _, part := range strings.Split(spec, \";\") { if !strings.Contains(part, \"-\") { return fmt.Errorf(\"bad part %q\", part) } }","typeGuard":null,"tryCatchPattern":"ranges, err := parseRanges(spec); if err != nil { return fmt.Errorf(\"bad spec %q: %w\", spec, err) }","preventionTips":["Use ';' between ranges and '-' inside each range","Test specs against the parser before production use","Never copy specs with locale-dependent separators"],"tags":["parsing","range","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}