{"record":{"id":"c5862baaa162c862","repo":"jaegertracing/jaeger","slug":"multiple-backend-types-found-for-metric-storage","errorCode":null,"errorMessage":"multiple backend types found for metric storage: %v","messagePattern":"multiple backend types found for metric storage: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/storageconfig/config.go","lineNumber":178,"sourceCode":"func (cfg *MetricBackend) Validate() error {\n\tvar backends []string\n\tif cfg.Prometheus != nil {\n\t\tbackends = append(backends, \"prometheus\")\n\t}\n\tif cfg.Elasticsearch != nil {\n\t\tbackends = append(backends, \"elasticsearch\")\n\t}\n\tif cfg.Opensearch != nil {\n\t\tbackends = append(backends, \"opensearch\")\n\t}\n\tif cfg.ClickHouse != nil {\n\t\tbackends = append(backends, \"clickhouse\")\n\t}\n\tif len(backends) == 0 {\n\t\treturn errors.New(\"empty configuration\")\n\t}\n\tif len(backends) > 1 {\n\t\treturn fmt.Errorf(\"multiple backend types found for metric storage: %v\", backends)\n\t}\n\treturn nil\n}\n\n// Validate validates the storage configuration.\nfunc (c *Config) Validate() error {\n\tif len(c.TraceBackends) == 0 {\n\t\treturn errors.New(\"at least one storage backend is required\")\n\t}\n\tfor name, b := range c.TraceBackends {\n\t\tif err := b.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"trace storage '%s': %w\", name, err)\n\t\t}\n\t}\n\tfor name, b := range c.MetricBackends {\n\t\tif err := b.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"metric storage '%s': %w\", name, err)\n\t\t}","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/internal/storageconfig/config.go#L160-L196","documentation":"Same one-backend-per-definition rule as the trace variant, applied to metric storage: MetricBackend.Validate() gathers all populated backend types and rejects any metric backend entry that specifies more than one, returning this error with the list of types found.","triggerScenarios":"Calling Config.Validate() with a MetricBackends entry that has two or more backend fields populated, e.g. both `prometheus:` (remote storage config) and `clickhouse:` set on the same named metric backend.","commonSituations":"Config merge/Helm values layering that adds a second metric backend type to an existing entry; example configs combined by hand; leftovers of a migration from one metrics backend to another.","solutions":["Keep exactly one backend type field inside each named metric backend entry; remove the extra","Define separate named metric backends if you genuinely want multiple types available, then reference one per role","Use the %v list in the error to identify which two types collided and which config keys to delete","Audit generated/merged config (print the effective YAML) before starting Jaeger"],"exampleFix":"// before (config.yaml)\njaeger:\n  storage:\n    metric_backends:\n      metrics:\n        prometheus:\n          host: \"http://prom:9090\"\n        clickhouse:\n          address: clickhouse:9000\n// after\njaeger:\n  storage:\n    metric_backends:\n      metrics:\n        prometheus:\n          host: \"http://prom:9090\"","handlingStrategy":"validation","validationCode":"var cfg storageconfig.Config\nif err := v.Unmarshal(&cfg); err != nil { return err }\nfor name, b := range cfg.MetricBackends {\n    types := 0\n    for _, set := range []interface{}{b.Prometheus, b.ClickHouse} {\n        if !reflect.ValueOf(set).IsNil() { types++ }\n    }\n    if types > 1 {\n        return fmt.Errorf(\"metric backend %q sets %d storage types; keep exactly one\", name, types)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"multiple backend types found for metric storage\") {\n        // fix the named metric_backends entry named in the message\n    }\n    return err\n}","preventionTips":["Exactly one backend type field per named metric backend","Remove legacy metric backend fields when migrating between backends","Check merge tooling output for duplicated type keys under one entry","Validate config in CI before rollout"],"tags":["config","storage","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}