jaegertracing/jaeger · error

metric storage '%s': %w

Error message

metric storage '%s': %w

What it means

The metric-storage counterpart of the trace wrapper: top-level Config.Validate() wraps any error from a named metric backend's Validate() as `metric storage '%s': %w`, identifying which entry in jaeger.storage.metric_backends failed and why.

Source

Thrown at cmd/internal/storageconfig/config.go:195

	if len(backends) > 1 {
		return fmt.Errorf("multiple backend types found for metric storage: %v", backends)
	}
	return nil
}

// Validate validates the storage configuration.
func (c *Config) Validate() error {
	if len(c.TraceBackends) == 0 {
		return errors.New("at least one storage backend is required")
	}
	for name, b := range c.TraceBackends {
		if err := b.Validate(); err != nil {
			return fmt.Errorf("trace storage '%s': %w", name, err)
		}
	}
	for name, b := range c.MetricBackends {
		if err := b.Validate(); err != nil {
			return fmt.Errorf("metric storage '%s': %w", name, err)
		}
	}
	return nil
}

View on GitHub (pinned to 806f444784)

Solutions

  1. Fix the named entry shown in the error (`metric storage 'NAME'`) so it has exactly one valid backend type field
  2. Remove metric_backends entries you don't use — an empty definition always fails validation
  3. Read the wrapped cause for the specific rule violated (empty configuration vs multiple backend types)
  4. Validate the final merged config before deploy (e.g. run the binary with `--config ...` in dry form / print effective config)

Example fix

// before (config.yaml)
jaeger:
  storage:
    metric_backends:
      m1: {}
// after
jaeger:
  storage:
    metric_backends:
      m1:
        prometheus:
          host: "http://prometheus:9090"
Defensive patterns

Strategy: validation

Validate before calling

var cfg storageconfig.Config
if err := v.Unmarshal(&cfg); err != nil { return err }
for name, b := range cfg.MetricBackends {
    if err := b.Validate(); err != nil {
        return fmt.Errorf("pre-check metric backend %q: %w", name, err)
    }
}

Try / catch

if err := cfg.Validate(); err != nil {
    var name string
    if m := regexp.MustCompile(`metric storage '([^']+)'`).FindStringSubmatch(err.Error()); m != nil {
        name = m[1]
    }
    return fmt.Errorf("fix jaeger.storage.metric_backends entry %q: %w", name, err)
}

Prevention

When it happens

Trigger: Calling Config.Validate() where an entry in MetricBackends fails validation — typically an empty backend body (nothing unmarshaled) or multiple backend types set on one entry.

Common situations: Metric backends defined with only a name and no type; a key typo under the backend so its type field never populates; merge tooling dropping the backend body.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/9044500ce40ff08d. Report an issue: GitHub.