{"record":{"id":"a7429d8b45d65e5f","repo":"thanos-io/thanos","slug":"parsing-config-tracing-yaml","errorCode":null,"errorMessage":"parsing config tracing YAML","messagePattern":"parsing config tracing YAML","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tracing/client/factory.go","lineNumber":47,"sourceCode":"\tStackdriver           TracingProvider = \"STACKDRIVER\"\n\tGoogleCloud           TracingProvider = \"GOOGLE_CLOUD\"\n\tJaeger                TracingProvider = \"JAEGER\"\n\tElasticAPM            TracingProvider = \"ELASTIC_APM\"\n\tLightstep             TracingProvider = \"LIGHTSTEP\"\n\tOpenTelemetryProtocol TracingProvider = \"OTLP\"\n)\n\ntype TracingConfig struct {\n\tType   TracingProvider `yaml:\"type\"`\n\tConfig any             `yaml:\"config\"`\n}\n\nfunc NewTracer(ctx context.Context, logger log.Logger, metrics *prometheus.Registry, confContentYaml []byte) (opentracing.Tracer, io.Closer, error) {\n\tlevel.Info(logger).Log(\"msg\", \"loading tracing configuration\")\n\ttracingConf := &TracingConfig{}\n\n\tif err := yaml.UnmarshalStrict(confContentYaml, tracingConf); err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"parsing config tracing YAML\")\n\t}\n\n\tvar config []byte\n\tvar err error\n\tif tracingConf.Config != nil {\n\t\tconfig, err = yaml.Marshal(tracingConf.Config)\n\t\tif err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"marshal content of tracing configuration\")\n\t\t}\n\t}\n\n\tswitch strings.ToUpper(string(tracingConf.Type)) {\n\tcase string(Stackdriver), string(GoogleCloud):\n\t\ttracerProvider, err := google_cloud.NewTracerProvider(ctx, logger, config)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\ttracer, closerFunc := migration.Bridge(tracerProvider, logger)","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/tracing/client/factory.go#L29-L65","documentation":"NewTracer in pkg/tracing/client/factory.go parses the tracing configuration YAML with yaml.UnmarshalStrict into TracingConfig. This error wraps any failure to parse that YAML, including unknown fields because strict unmarshalling is used. It indicates the tracing config content supplied to NewTracer is not valid YAML or does not match the TracingConfig schema.","triggerScenarios":"Calling NewTracer with confContentYaml that is malformed YAML, contains fields not defined in TracingConfig (strict mode rejects unknown keys), or has wrong types for 'type'/'config' fields.","commonSituations":"Typos in the tracing config block of the Thanos flag yaml file (e.g. 'typ: jaeger'), indentation errors, adding a vendor-specific key at the top level instead of under 'config', or passing an empty/placeholder file.","solutions":["Validate the YAML with a linter and confirm it only contains 'type' and 'config' keys","Move backend-specific settings (e.g. Jaeger agent/sampler options) under the nested 'config' key, not the top level","Fix YAML indentation/typos so it unmarshals cleanly","Enable only supported fields for the chosen tracing type per docs"],"exampleFix":"// before\ntracing:\n  typ: jaeger\n  agent_host: localhost\n// after\ntracing:\n  type: JAEGER\n  config:\n    agent_host: localhost","handlingStrategy":"validation","validationCode":"// Go: validate before calling NewTracer\nvar probe map[string]interface{}\nif err := yaml.Unmarshal(confContentYaml, &probe); err != nil {\n    return fmt.Errorf(\"tracing config is not valid YAML: %w\", err)\n}\nfor _, k := range []string{\"type\", \"config\"} {\n    if _, ok := probe[k]; !ok && k == \"type\" {\n        return fmt.Errorf(\"tracing config missing required field 'type'\")\n    }\n}\nif _, ok := probe[\"typ\"]; ok {\n    return fmt.Errorf(\"tracing config has unknown key 'typ'; strict mode will reject it\")\n}","typeGuard":null,"tryCatchPattern":"op, closer, err := tracing.NewTracer(ctx, logger, reg, cfgYaml)\nif err != nil {\n    if strings.Contains(err.Error(), \"parsing config tracing YAML\") {\n        logger.Error(err, \"fix tracing YAML: check syntax, unknown keys and nesting\")\n    }\n    return err\n}","preventionTips":["Keep tracing YAML limited to 'type' and 'config' keys — UnmarshalStrict rejects anything else","Lint the YAML before deployment (yamllint or a CI schema check)","Put vendor-specific options under 'config', never at top level","Validate config in a staging run of NewTracer before rollout"],"tags":["yaml","configuration","tracing","thanos"],"backgroundTag":"schema-validation-failed","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"}