{"record":{"id":"3d06002a5b21e35b","repo":"thanos-io/thanos","slug":"parsing-downstream-tripper-config-yaml-file","errorCode":null,"errorMessage":"parsing downstream tripper config YAML file","messagePattern":"parsing downstream tripper config YAML file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/query_frontend.go","lineNumber":206,"sourceCode":"func parseTransportConfiguration(downstreamTripperConfContentYaml []byte) (*http.Transport, error) {\n\tdownstreamTripper := &http.Transport{\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tDialContext: (&net.Dialer{\n\t\t\tTimeout:   30 * time.Second,\n\t\t\tKeepAlive: 30 * time.Second,\n\t\t\tDualStack: true,\n\t\t}).DialContext,\n\t\tForceAttemptHTTP2:     true,\n\t\tMaxIdleConns:          100,\n\t\tIdleConnTimeout:       90 * time.Second,\n\t\tTLSHandshakeTimeout:   10 * time.Second,\n\t\tExpectContinueTimeout: 1 * time.Second,\n\t}\n\n\tif len(downstreamTripperConfContentYaml) > 0 {\n\t\ttripperConfig := &queryfrontend.DownstreamTripperConfig{}\n\t\tif err := yaml.UnmarshalStrict(downstreamTripperConfContentYaml, tripperConfig); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"parsing downstream tripper config YAML file\")\n\t\t}\n\n\t\tif tripperConfig.TLSConfig != nil {\n\t\t\ttlsConfig, err := exthttp.NewTLSConfig(tripperConfig.TLSConfig)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"parsing downstream tripper TLS config YAML\")\n\t\t\t}\n\t\t\tdownstreamTripper.TLSClientConfig = tlsConfig\n\t\t}\n\t\tif tripperConfig.IdleConnTimeout > 0 {\n\t\t\tdownstreamTripper.IdleConnTimeout = time.Duration(tripperConfig.IdleConnTimeout)\n\t\t}\n\t\tif tripperConfig.ResponseHeaderTimeout > 0 {\n\t\t\tdownstreamTripper.ResponseHeaderTimeout = time.Duration(tripperConfig.ResponseHeaderTimeout)\n\t\t}\n\t\tif tripperConfig.TLSHandshakeTimeout > 0 {\n\t\t\tdownstreamTripper.TLSHandshakeTimeout = time.Duration(tripperConfig.TLSHandshakeTimeout)\n\t\t}","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/query_frontend.go#L188-L224","documentation":"This error is returned by parseTransportConfiguration when yaml.UnmarshalStrict fails to decode the downstream tripper config YAML into queryfrontend.DownstreamTripperConfig. UnmarshalStrict is used, so unknown fields also fail. It wraps the underlying YAML/field error for diagnosis.","triggerScenarios":"Providing --downstream-tripper-config-file or --downstream-tripper-config content that is invalid YAML or contains fields not present in DownstreamTripperConfig (strict unmarshalling rejects unknown keys).","commonSituations":"Copied Cortex config with unsupported keys, YAML tabs instead of spaces, wrong types (e.g. string where a duration is expected), or leftover fields after a Thanos version upgrade.","solutions":["Validate the YAML syntax (yamllint) and fix indentation/tabs.","Remove unknown fields; strict unmarshalling rejects any key not in DownstreamTripperConfig.","Check field types: durations like idle_conn_timeout must be valid duration strings.","Read the wrapped underlying error to identify the exact offending line/field."],"exampleFix":"// before (unknown field, fails strict unmarshal)\nidle_conn_timeout: 90s\nmax_idle_conns_per_host: 100\nunknown_field: true\n// after\nidle_conn_timeout: 90s\nmax_idle_conns_per_host: 100","handlingStrategy":"validation","validationCode":"var probe map[string]any\nif err := yaml.Unmarshal(raw, &probe); err != nil {\n  return fmt.Errorf(\"downstream tripper YAML invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"cfg := &queryfrontend.DownstreamTripperConfig{}\nif err := yaml.UnmarshalStrict(content, cfg); err != nil {\n  log.Fatalf(\"bad downstream tripper config: %v\", err)\n}","preventionTips":["Avoid unknown fields — strict unmarshal rejects them","Validate YAML with a linter before deployment","Check duration field syntax (e.g. 90s, 1m)"],"tags":["config","yaml","unmarshal"],"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"}