{"record":{"id":"7f047de98c4ec9b2","repo":"thanos-io/thanos","slug":"configuration-file-is-not-parsable","errorCode":null,"errorMessage":"configuration file is not parsable","messagePattern":"configuration file is not parsable","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/receive/config.go","lineNumber":30,"sourceCode":"\t\"io\"\n\t\"os\"\n\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)","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/config.go#L12-L48","documentation":"errParseConfigurationFile is a sentinel returned by loadConfig when ParseConfig cannot parse the hashring configuration file content. The config watcher reads the hashring file and parses it into []HashringConfig; any syntax or schema error in the file is wrapped with this sentinel so callers can detect parse failure via errors.Is. Receive cannot build a hashring until the file parses.","triggerScenarios":"loadConfig -> ParseConfig fails: invalid JSON/YAML syntax, unknown fields, or endpoint structures that do not unmarshal into Endpoint (before the empty check at config.go:402).","commonSituations":"Hand-edited hashring.json with a typo; config management tool writing a partial/truncated file; quoting or trailing-comma mistakes in the endpoints list.","solutions":["Validate the file with a JSON/YAML linter or `thanos tools bucket` style parse before deploying","Check the wrapped %v detail in the error for the exact parse position","Ensure the writer atomically replaces the file (write temp + rename) so the watcher never reads a half-written file","Restore a known-good hashring config and redeploy"],"exampleFix":"// before (malformed)\n[{\"endpoints\": [{\"address\": \"recv-0:10901\"}]\n// after (valid)\n[{\"endpoints\": [{\"address\": \"recv-0:10901\"}]}]","handlingStrategy":"validation","validationCode":"// validate hashring JSON before deploying\nvar v []map[string]json.RawMessage\nif err := json.Unmarshal(content, &v); err != nil {\n\treturn fmt.Errorf(\"invalid hashring config: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"_, _, err := receive.ValidateConfig(logger, path)\nif errors.Is(err, errParseConfigurationFile) {\n\t// reject deployment; fix file syntax\n}","preventionTips":["Lint hashring configs in CI before rollout","Use atomic writes (temp file + rename) for config updates","Pin a JSON schema for the hashring file in your config templates"],"tags":["config","hashring","parsing"],"backgroundTag":"json-parse-error","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"}