{"record":{"id":"a9c342aebe84660a","repo":"thanos-io/thanos","slug":"marshal-content-of-tracing-configuration","errorCode":null,"errorMessage":"marshal content of tracing configuration","messagePattern":"marshal content of tracing configuration","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tracing/client/factory.go","lineNumber":55,"sourceCode":"type 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)\n\t\treturn tracer, closerFunc, nil\n\tcase string(Jaeger):\n\t\ttracerProvider, err := jaeger.NewTracerProvider(ctx, logger, config)\n\t\tif err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"new tracer provider err\")\n\t\t}\n\t\ttracer, closerFunc := migration.Bridge(tracerProvider, logger)\n\t\treturn tracer, closerFunc, nil","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/tracing/client/factory.go#L37-L73","documentation":"After strict-unmarshalling TracingConfig, NewTracer re-marshals the nested tracingConf.Config (the backend-specific settings) back to YAML to feed the vendor tracer constructor. This error wraps a yaml.Marshal failure of that config value. It is rare and indicates the parsed config cannot be serialized (e.g. an unsupported value type was programmatically injected).","triggerScenarios":"tracingConf.Config is non-nil but contains values yaml.Marshal cannot represent (custom types, channels, funcs) — typically only when TracingConfig is constructed in code rather than parsed from YAML.","commonSituations":"Embedding Thanos tracing config programmatically with non-marshalable Go values inside Config; usually not hit via normal YAML-flag loading.","solutions":["Ensure Config is populated from parsed YAML (map[string]interface{} or yaml.Node), not arbitrary Go values","Marshal the value standalone to identify the offending field","Upgrade Thanos; marshal failures on plain YAML-loaded maps are library bugs"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Only construct TracingConfig from parsed YAML; never inject raw Go values into Config\nif tracingConf.Config != nil {\n    if _, err := yaml.Marshal(tracingConf.Config); err != nil {\n        return fmt.Errorf(\"tracing Config value not YAML-marshalable: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"tracer, closer, err := tracing.NewTracer(ctx, logger, reg, cfgYaml)\nif err != nil && strings.Contains(err.Error(), \"marshal content of tracing configuration\") {\n    logger.Error(err, \"tracing Config contains non-marshalable values; load it from YAML\")\n    return err\n}","preventionTips":["Populate TracingConfig only via yaml.Unmarshal, not by hand-built structs with exotic types","Avoid embedding funcs/channels/custom non-marshalable types in Config","If this fires from plain YAML, report as a library bug and upgrade Thanos"],"tags":["yaml","configuration","tracing","serialization"],"backgroundTag":"json-marshal-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"}