thanos-io/thanos · error
parsing http config YAML
Error message
parsing http config YAML
What it means
After obtaining the raw content, the sidecar converts it into a client-go style HTTPClientConfig via clientconfig.NewHTTPClientConfigFromYAML(httpConfContentYaml). If the content is not valid YAML or doesn't match the HTTPClientConfig schema (e.g. unknown tls_config fields), startup aborts with "parsing http config YAML".
Solutions
- Paste the config content into a YAML linter/parser to catch syntax errors (tabs vs spaces, stray characters).
- Validate keys against the prometheus/common config HTTPClientConfig schema (http_headers, tls_config with ca_file/cert_file/key_file, bearer_token, etc.).
- Read the wrapped unmarshal error in the message — it names the offending key and line.
- Start from a known-good minimal config like `{}` or `{"tls_config": {"insecure_skip_verify": true}}` and add fields incrementally.
Example fix
// before
{"tls_config": {"certificate_file": "/certs/tls.crt"}}
// after
{"tls_config": {"cert_file": "/certs/tls.crt", "key_file": "/certs/tls.key"}} Defensive patterns
Strategy: validation
Validate before calling
func validHTTPClientYAML(y string) error {
var cfg clientconfig.HTTPClientConfig
return yaml.UnmarshalStrict([]byte(y), &cfg) // same strict decode the sidecar performs
} Type guard
null
Try / catch
httpClientConfig, err := clientconfig.NewHTTPClientConfigFromYAML(httpConfContentYaml)
if err != nil {
return fmt.Errorf("parsing http config YAML: %w (check keys against prometheus/common HTTPClientConfig schema)", err)
} Prevention
- Pre-parse your config with yaml.UnmarshalStrict into HTTPClientConfig in tests to catch unknown keys early
- Avoid tabs in YAML; use spaces and validate with a YAML linter
- Copy TLS/auth keys only from the prometheus/common config schema documentation
When it happens
Trigger: Passing an HTTP client config whose content is invalid YAML (tabs, bad indentation) or contains unknown/mistyped keys (e.g. tls_config.certificate_file instead of cert_file), so NewHTTPClientConfigFromYAML fails at cmd/thanos/sidecar.go:78.
Common situations: Hand-written YAML with indentation/tab errors; Prometheus-format TLS blocks copied incorrectly; JSON passed where strict YAML decoding rejects duplicate or unknown keys; schema drift between client-go versions.
Related errors
- getting http client config
- Improper http client config
- unable to parse objstore config
- parsing config YAML file
- unable to unmarshal config content
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/9b51b616434b4ad1.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/thanos/sidecar.go:79
func registerSidecar(app *extkingpin.App) {
cmd := app.Command(component.Sidecar.String(), "Sidecar for Prometheus server.")
conf := &sidecarConfig{}
conf.registerFlag(cmd)
cmd.Setup(func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ <-chan struct{}, _ bool) error {
grpcLogOpts, logFilterMethods, err := logging.ParsegRPCOptions(conf.reqLogConfig)
if err != nil {
return errors.Wrap(err, "error while parsing config for request logging")
}
httpConfContentYaml, err := conf.prometheus.httpClient.Content()
if err != nil {
return errors.Wrap(err, "getting http client config")
}
httpClientConfig, err := clientconfig.NewHTTPClientConfigFromYAML(httpConfContentYaml)
if err != nil {
return errors.Wrap(err, "parsing http config YAML")
}
httpClient, err := clientconfig.NewHTTPClient(*httpClientConfig, "thanos-sidecar")
if err != nil {
return errors.Wrap(err, "Improper http client config")
}
opts := reloader.Options{
HTTPClient: *httpClient,
CfgFile: conf.reloader.confFile,
CfgOutputFile: conf.reloader.envVarConfFile,
WatchedDirs: conf.reloader.ruleDirectories,
WatchInterval: conf.reloader.watchInterval,
RetryInterval: conf.reloader.retryInterval,
}
switch conf.reloader.method {
case HTTPReloadMethod:View on GitHub (pinned to 35b8b99117)