{"record":{"id":"9cdeaade81b649da","repo":"thanos-io/thanos","slug":"configuration-file-is-empty","errorCode":null,"errorMessage":"configuration file is empty","messagePattern":"configuration file is empty","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/receive/config.go","lineNumber":32,"sourceCode":"\t\"path/filepath\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/fsnotify/fsnotify\"\n\t\"github.com/go-kit/log\"\n\t\"github.com/go-kit/log/level\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/prometheus/client_golang/prometheus\"\n\t\"github.com/prometheus/client_golang/prometheus/promauto\"\n\t\"github.com/prometheus/common/model\"\n\t\"github.com/prometheus/prometheus/model/labels\"\n)\n\nvar (\n\t// An errParseConfigurationFile is returned by the ConfigWatcher when parsing failed.\n\terrParseConfigurationFile = errors.New(\"configuration file is not parsable\")\n\t// An errEmptyConfigurationFile is returned by the ConfigWatcher when attempting to load an empty configuration file.\n\terrEmptyConfigurationFile = errors.New(\"configuration file is empty\")\n)\n\ntype ReceiverMode string\n\nconst (\n\tRouterOnly     ReceiverMode = \"RouterOnly\"\n\tIngestorOnly   ReceiverMode = \"IngestorOnly\"\n\tRouterIngestor ReceiverMode = \"RouterIngestor\"\n\n\tDefaultCapNProtoPort string = \"19391\"\n)\n\ntype endpoints []Endpoint\n\nfunc (e endpoints) Len() int {\n\treturn len(e)\n}\n","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/config.go#L14-L50","documentation":"errEmptyConfigurationFile is a sentinel returned by loadConfig when the hashring file parses successfully but yields an empty configuration (len(config) == 0) — e.g. the file is empty, contains only whitespace, or a zero-length hashring list. Receive requires at least one hashring entry to route series, so an empty config is rejected.","triggerScenarios":"loadConfig reads a file whose parsed result is an empty slice or nil: empty file, `[]` as the whole config, or a config-management tool clearing the file during an update.","commonSituations":"Kubernetes ConfigMap momentarily emptied during an update; a template renderer producing an empty output; operator accidentally deploying `[]` instead of the hashring list.","solutions":["Populate the file with at least one hashring entry containing a non-empty endpoints list","Make config updates atomic (temp file + rename) so watchers never see an empty intermediate state","Verify the ConfigMap/secret volume actually mounted content (check for emptyDir fallback)","Compare the deployed file against the intended hashring topology"],"exampleFix":"// before\n[]\n// after\n[{\"endpoints\": [{\"address\": \"recv-0:10901\"}, {\"address\": \"recv-1:10901\"}]}]","handlingStrategy":"validation","validationCode":"var v []map[string]interface{}\nif err := json.Unmarshal(content, &v); err != nil {\n\treturn err\n}\nif len(v) == 0 {\n\treturn errors.New(\"hashring config is empty; at least one entry required\")\n}","typeGuard":null,"tryCatchPattern":"if errors.Is(err, errEmptyConfigurationFile) {\n\t// block rollout; regenerate config with real endpoints\n}","preventionTips":["Never deploy a hashring config that renders to an empty list; assert in your templating pipeline","Use atomic replace so the watcher never observes an empty intermediate file","Alert when a rendered config has zero endpoints"],"tags":["config","hashring","empty"],"backgroundTag":"missing-required-config","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"}