jaegertracing/jaeger · error

cannot use both 'rotation' config and legacy flags (%s) simu

Error message

cannot use both 'rotation' config and legacy flags (%s) simultaneously; remove the legacy flags and use the 'rotation' section instead

What it means

Index rotation can now be configured via the structured 'rotation' section under indices.*. Jaeger rejects mixing that section with the legacy rotation CLI flags in a single config, because the two mechanisms would conflict. validateRotationConfig raises this error when both are present.

Source

Thrown at internal/storage/elasticsearch/config/config_rotation.go:109

	// Useful for cross-cluster search or to decouple consumer queries from the
	// underlying data stream name. If empty, reads go directly to the data stream.
	ReadAlias string `mapstructure:"read_alias"`
}

// HasRotation returns true if any rotation variant is explicitly configured.
func (r *RotationConfig) HasRotation() bool {
	return r.Periodic.HasValue() || r.ManualRollover.HasValue() ||
		r.AutoRollover.HasValue() || r.DataStream.HasValue()
}

func (c *Configuration) validateRotationConfig() error {
	hasAnyRotation := c.Indices.Spans.Rotation.HasRotation() ||
		c.Indices.Services.Rotation.HasRotation() ||
		c.Indices.Dependencies.Rotation.HasRotation() ||
		c.Indices.Sampling.Rotation.HasRotation()

	if hasAnyRotation && c.hasAnyLegacyRotationFlags() {
		return fmt.Errorf(
			"cannot use both 'rotation' config and legacy flags (%s) simultaneously; "+
				"remove the legacy flags and use the 'rotation' section instead",
			legacyRotationFlagsList,
		)
	}

	type rotationEntry struct {
		name     string
		opts     *IndexOptions
		rotation *RotationConfig
	}
	entries := []rotationEntry{
		{"spans", &c.Indices.Spans, &c.Indices.Spans.Rotation},
		{"services", &c.Indices.Services, &c.Indices.Services.Rotation},
		{"dependencies", &c.Indices.Dependencies, &c.Indices.Dependencies.Rotation},
		{"sampling", &c.Indices.Sampling, &c.Indices.Sampling.Rotation},
	}
	for _, e := range entries {

View on GitHub (pinned to 806f444784)

Solutions

  1. Delete the legacy rotation flags from args/env
  2. Keep only the 'rotation' section under indices.*
  3. If you intend legacy behavior, remove the rotation section instead

Example fix

// before
indices:
  spans:
    rotation:
      periodic:
        days: 1
args: [--es.index-rotation.day-hour=...]  # legacy flag
// after
indices:
  spans:
    rotation:
      periodic:
        days: 1
Defensive patterns

Strategy: validation

Validate before calling

hasRotationSection := cfg.Indices.Spans.Rotation.HasRotation() || cfg.Indices.Services.Rotation.HasRotation()
if hasRotationSection && len(legacyRotationFlagsFromArgs(os.Args)) > 0 {
    return errors.New("remove legacy rotation flags; use indices.*.rotation only")
}

Prevention

When it happens

Trigger: Config has at least one indices.<type>.rotation entry with HasRotation() true AND any legacy rotation flag (hasAnyLegacyRotationFlags) set, then Validate is called.

Common situations: Partially migrating a config: adding the new rotation section while old --es.index-rotation flags remain in the deployment manifest or command line.

Related errors


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