{"record":{"id":"3b359685186add95","repo":"thanos-io/thanos","slug":"unable-to-load-config-content-s","errorCode":null,"errorMessage":"unable to load config content: %s","messagePattern":"unable to load config content: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/endpointset.go","lineNumber":175,"sourceCode":"\tif cfg.Compression != \"none\" && cfg.Compression != \"snappy\" {\n\t\treturn errors.Newf(\"invalid compression: %s, must be 'none' or 'snappy'\", cfg.Compression)\n\t}\n\treturn nil\n}\n\nfunc (er *endpointConfigProvider) config() EndpointConfig {\n\ter.mu.Lock()\n\tdefer er.mu.Unlock()\n\n\tres := EndpointConfig{Endpoints: make([]endpointSettings, len(er.cfg.Endpoints)), DefaultClientConfig: er.cfg.DefaultClientConfig}\n\tcopy(res.Endpoints, er.cfg.Endpoints)\n\treturn res\n}\n\nfunc (er *endpointConfigProvider) parse(configFile fileContent) (EndpointConfig, error) {\n\tcontent, err := configFile.Content()\n\tif err != nil {\n\t\treturn EndpointConfig{}, errors.Wrapf(err, \"unable to load config content: %s\", configFile.Path())\n\t}\n\tvar cfg EndpointConfig\n\tif err := yaml.Unmarshal(content, &cfg); err != nil {\n\t\treturn EndpointConfig{}, errors.Wrapf(err, \"unable to unmarshal config content: %s\", configFile.Path())\n\t}\n\treturn cfg, nil\n}\n\nfunc (er *endpointConfigProvider) addStaticEndpoints(cfg *EndpointConfig) {\n\tfor _, e := range er.endpoints {\n\t\tcfg.Endpoints = append(cfg.Endpoints, endpointSettings{\n\t\t\tAddress: e,\n\t\t})\n\t}\n\tfor _, e := range er.endpointGroups {\n\t\tcfg.Endpoints = append(cfg.Endpoints, endpointSettings{\n\t\t\tAddress: e,\n\t\t\tGroup:   true,","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/endpointset.go#L157-L193","documentation":"This error is raised when the endpoint config file's content cannot be read from disk (configFile.Content() fails) while parsing endpointset configuration. Thanos wraps the underlying I/O error with the config file path so operators know which file failed. It aborts building the endpoint config provider.","triggerScenarios":"Calling endpointConfigProvider.parse when configFile.Content() errors: the file was deleted/moved after discovery, permissions deny read, it's a directory not a file, or the underlying watch/reader returns an I/O error.","commonSituations":"Operator points --endpoint-config or --endpoint-config-ndjson at a missing or renamed file; k8s ConfigMap mount not yet present or removed; file unreadable by the Thanos process user (permissions/SELinux).","solutions":["Verify the file exists at the exact path reported in the error (ls -l) and is readable by the Thanos process user.","Fix mount/secret setup so the config file is present at startup (e.g., correct ConfigMap volume mount path).","If using the nop/static endpoints mode, ensure no endpoint-config flag is passed so a NopConfig is used instead.","Check fsnotify/watcher support on the filesystem (NFS, tmpfs) — fall back to static --endpoint flags if watching is unreliable."],"exampleFix":"// before: file may not exist\ncontent, err := configFile.Content()\nif err != nil { return EndpointConfig{}, errors.Wrapf(err, \"unable to load config content: %s\", configFile.Path()) }\n// after: guard with an existence check before parse\nif _, statErr := os.Stat(configFile.Path()); os.IsNotExist(statErr) {\n    return EndpointConfig{}, errors.Errorf(\"endpoint config file does not exist: %s\", configFile.Path())\n}\ncontent, err := configFile.Content()","handlingStrategy":"validation","validationCode":"func canReadConfig(p string) error { fi, err := os.Stat(p); if err != nil { return err }; if fi.IsDir() { return fmt.Errorf(\"%s is a directory\", p) }; f, err := os.Open(p); if err != nil { return err }; return f.Close() }","typeGuard":"func fileReadable(p string) bool { f, err := os.Open(p); if err != nil { return false }; _ = f.Close(); return true }","tryCatchPattern":"cfg, err := provider.parse(configFile)\nif err != nil {\n    var pathErr *os.PathError\n    if errors.As(err, &pathErr) { log.Fatalf(\"endpoint config unreadable: %s: %v\", pathErr.Path, pathErr.Err) }\n    return err\n}","preventionTips":["Pre-check file existence/readability at startup before passing to --endpoint-config.","In k8s, verify ConfigMap/Secret mounts exist in the readiness probe.","Keep endpoint config paths absolute and stable; avoid symlinks into volatile locations.","Run Thanos with a service user that has read permission on the config."],"tags":["config","file-io","thanos","endpoints"],"backgroundTag":"file-read-failed","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"}