{"record":{"id":"505548716faec9ae","repo":"thanos-io/thanos","slug":"hash-file","errorCode":null,"errorMessage":"hash file","messagePattern":"hash file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/reloader/reloader.go","lineNumber":411,"sourceCode":"\tif err := os.Rename(tmpFile, outputFile); err != nil {\n\t\treturn errors.Wrap(err, \"rename file\")\n\t}\n\treturn nil\n}\n\n// apply triggers Prometheus reload if rules or config changed. If cfgOutputFile is set, we also\n// expand env vars into config file before reloading.\n// Reload is retried in retryInterval until watchInterval.\nfunc (r *Reloader) apply(ctx context.Context) error {\n\tvar (\n\t\tcfgHash         []byte\n\t\twatchedDirsHash []byte\n\t)\n\n\tif r.cfgFile != \"\" {\n\t\th := sha256.New()\n\t\tif err := hashFile(h, r.cfgFile); err != nil {\n\t\t\treturn errors.Wrap(err, \"hash file\")\n\t\t}\n\t\tcfgHash = h.Sum(nil)\n\t\tif r.cfgOutputFile != \"\" {\n\t\t\tif err := r.normalize(r.cfgFile, r.cfgOutputFile); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tcfgDirsHash := make([][]byte, len(r.cfgDirs))\n\tcfgDirsChanged := len(r.lastCfgDirsHash) == 0 && len(r.cfgDirs) > 0\n\tfor i, cfgDir := range r.cfgDirs {\n\t\th := sha256.New()\n\n\t\twalkDir, err := filepath.EvalSymlinks(cfgDir.Dir)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"dir symlink eval\")\n\t\t}","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/reloader/reloader.go#L393-L429","documentation":"Reloader.apply fails hashing the config file with hashFile for change detection — the file disappeared or became unreadable between watches — so the reload cycle aborts and is retried on the next interval.","triggerScenarios":"Thrown at pkg/reloader/reloader.go:411 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the config file path is stable and mounted.","Inspect the wrapped OS error (ENOENT, EACCES).","The Watch loop retries; fix the mount to stop the errors."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}