{"record":{"id":"552c8cac646d8eec","repo":"thanos-io/thanos","slug":"failed-to-parse-remote-write-config-v","errorCode":null,"errorMessage":"failed to parse remote write config %v","messagePattern":"failed to parse remote write config (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/rule.go","lineNumber":484,"sourceCode":"\n\tvar (\n\t\tappendable storage.Appendable\n\t\tqueryable  storage.Queryable\n\t\ttsdbDB     *tsdb.DB\n\t\tagentDB    *agent.DB\n\t)\n\n\trwCfgYAML, err := conf.rwConfig.Content()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(rwCfgYAML) > 0 {\n\t\tvar rwCfg struct {\n\t\t\tRemoteWriteConfigs []*config.RemoteWriteConfig `yaml:\"remote_write,omitempty\"`\n\t\t}\n\t\tif err := yaml.Unmarshal(rwCfgYAML, &rwCfg); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to parse remote write config %v\", string(rwCfgYAML))\n\t\t}\n\n\t\tslogger := logutil.GoKitLogToSlog(logger)\n\t\t// flushDeadline is set to 1m, but it is for metadata watcher only so not used here.\n\t\t// TODO: add type and unit labels support?\n\t\tremoteStore := remote.NewStorage(slogger, reg, func() (int64, error) {\n\t\t\treturn 0, nil\n\t\t}, conf.dataDir, 1*time.Minute, &readyScrapeManager{}, false)\n\t\tif err := remoteStore.ApplyConfig(&config.Config{\n\t\t\tGlobalConfig: config.GlobalConfig{\n\t\t\t\tExternalLabels: labelsTSDBToProm(conf.lset),\n\t\t\t},\n\t\t\tRemoteWriteConfigs: rwCfg.RemoteWriteConfigs,\n\t\t}); err != nil {\n\t\t\treturn errors.Wrap(err, \"applying config to remote storage\")\n\t\t}\n\n\t\tagentDB, err = agent.Open(slogger, reg, remoteStore, conf.dataDir, agentOpts)","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/rule.go#L466-L502","documentation":"This error wraps a yaml.Unmarshal failure when parsing the remote write configuration YAML (conf.remoteWrite.config) into the {remote_write: [...]} struct in runRule. errors.Wrapf includes the raw YAML to help spot the problem. It means the provided remote-write YAML does not match Prometheus's remote_write schema.","triggerScenarios":"len(rwCfgYAML) > 0 and yaml.Unmarshal(rwCfgYAML, &rwCfg) fails — invalid YAML syntax or fields not present in config.RemoteWriteConfig.","commonSituations":"Using Thanos-incompatible remote_write fields, YAML indentation errors, passing a full Prometheus config file instead of just the remote_write section, quoting issues from env-var substitution in manifests.","solutions":["Validate the YAML parses standalone (yamlted or `promtool check config` on the equivalent Prometheus config).","Ensure the YAML has a top-level `remote_write:` key with a list of valid Prometheus remote_write configs — not a full prometheus.yml.","Remove fields unsupported by the vendored Prometheus config version in this Thanos build.","Check env substitution didn't inject empty or malformed values into the YAML."],"exampleFix":"// before\n# passed file contains full prometheus.yml\nscrape_configs: ...\n// after\nremote_write:\n  - url: http://receive:19291/api/v1/receive\n    queue_config:\n      max_samples_per_send: 2000","handlingStrategy":"validation","validationCode":"var probe struct {\n    RemoteWriteConfigs []*config.RemoteWriteConfig `yaml:\"remote_write\"`\n}\nif err := yaml.UnmarshalStrict(rwCfgYAML, &probe); err != nil {\n    return fmt.Errorf(\"remote_write yaml invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store only the remote_write section, not a full prometheus.yml.","Run promtool check config in CI on generated remote-write YAML.","Use UnmarshalStrict locally to catch unknown fields early."],"tags":["thanos","remote-write","yaml","config"],"backgroundTag":"yaml-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"}