{"record":{"id":"f54814cba86c3875","repo":"juicedata/juicefs","slug":"invalid-hour-number","errorCode":null,"errorMessage":"invalid hour number","messagePattern":"invalid hour number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/chunk/cached_store.go","lineNumber":645,"sourceCode":"\t\treturn\n\t}\n\tsplit := \",\"\n\tif strings.Contains(c.UploadHours, \"-\") {\n\t\tsplit = \"-\"\n\t}\n\tps := strings.Split(c.UploadHours, split)\n\tif len(ps) != 2 {\n\t\terr = errors.New(\"unexpected number of fields\")\n\t\treturn\n\t}\n\tif start, err = strconv.Atoi(ps[0]); err != nil {\n\t\treturn\n\t}\n\tif end, err = strconv.Atoi(ps[1]); err != nil {\n\t\treturn\n\t}\n\tif start < 0 || start > 23 || end < 0 || end > 23 {\n\t\terr = errors.New(\"invalid hour number\")\n\t}\n\treturn\n}\n\nfunc (c *Config) CacheEnabled() bool {\n\treturn c.CacheSize > 0\n}\n\ntype cachedStore struct {\n\tstorage         object.ObjectStorage\n\tbcache          CacheManager\n\tfetcher         *prefetcher\n\tconf            Config\n\tgroup           *Controller\n\tcurrentUpload   chan struct{}\n\tcurrentDownload chan struct{}\n\tpendingCh       chan *pendingItem\n\tpendingKeys     map[string]*pendingItem","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/chunk/cached_store.go#L627-L663","documentation":"parseHours validates the hour portion of cache-scan time ranges used by the disk cache free-space scan. It returns this error when either the start or end hour parsed from the range string is not a number between 0 and 23. The library throws it to reject malformed hour values in config options like free-space scan windows before they cause wrong scan scheduling.","triggerScenarios":"Calling NewCachedStore or SelfCheck with a config whose scan-range / hour field contains hours outside 0-23 (e.g. \"25:3\" or \"-1:8\") after strconv.Atoi succeeded on both parts.","commonSituations":"Typo in a cache configuration time range, copy-pasting a 24-hour convention like \"0:24\", or using locale-formatted hours in the Juicedata cache config (e.g. --free-space-rand or scan hours settings).","solutions":["Fix the hour range in the client config so both start and end are integers 0-23 (e.g. \"0:6\" instead of \"0:24\").","If a full-day range is needed, use \"0:23\" or omit the range option so the scan runs unconditionally.","Re-run juicefs mount after correcting the configuration and check the client log to confirm the cache scan starts."],"exampleFix":"// before\n--scan-hours 0:24\n// after\n--scan-hours 0:23","handlingStrategy":"validation","validationCode":"func validHours(s string) bool {\n\tparts := strings.SplitN(s, \":\", 2)\n\tif len(parts) != 2 { return false }\n\ta, err1 := strconv.Atoi(parts[0]); b, err2 := strconv.Atoi(parts[1])\n\treturn err1 == nil && err2 == nil && a >= 0 && a <= 23 && b >= 0 && b <= 23\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep hour ranges within 0-23 in cache config","Never use 24 as an end hour; use 0:23","Validate config strings before passing to mount"],"tags":["config","validation","cache"],"backgroundTag":"invalid-config-value","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}