jaegertracing/jaeger · error

only one sampling strategy provider can be specified, 'adapt

Error message

only one sampling strategy provider can be specified, 'adaptive' or 'file'

What it means

errMultipleProviders is returned by Config.Validate when both the 'adaptive' and 'file' sampling strategy providers are configured. The extension supports exactly one strategy source at a time, so having both is ambiguous and rejected.

Source

Thrown at cmd/jaeger/internal/extension/remotesampling/config.go:22

package remotesampling

import (
	"errors"
	"time"

	"github.com/asaskevich/govalidator"
	"go.opentelemetry.io/collector/component"
	"go.opentelemetry.io/collector/config/configgrpc"
	"go.opentelemetry.io/collector/config/confighttp"
	"go.opentelemetry.io/collector/config/configoptional"
	"go.opentelemetry.io/collector/confmap"

	"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy/adaptive"
)

var (
	errNoProvider        = errors.New("no sampling strategy provider specified, expecting 'adaptive' or 'file'")
	errMultipleProviders = errors.New("only one sampling strategy provider can be specified, 'adaptive' or 'file'")
	errNegativeInterval  = errors.New("reload interval must be a positive value, or zero to disable automatic reloading")
)

var (
	_ component.Config  = (*Config)(nil)
	_ confmap.Validator = (*Config)(nil)
)

type Config struct {
	File     configoptional.Optional[FileConfig]              `mapstructure:"file"`
	Adaptive configoptional.Optional[AdaptiveConfig]          `mapstructure:"adaptive"`
	HTTP     configoptional.Optional[confighttp.ServerConfig] `mapstructure:"http"`
	GRPC     configoptional.Optional[configgrpc.ServerConfig] `mapstructure:"grpc"`
}

type FileConfig struct {
	// File specifies a local file as the source of sampling strategies.
	Path string `mapstructure:"path"`

View on GitHub (pinned to 806f444784)

Solutions

  1. Remove one of the two provider blocks ('adaptive:' or 'file:') from the remotesampling extension config
  2. Keep only the provider you actually intend to serve; move the other strategy to a separate collector instance if both are needed
  3. Template your Helm/collector configs so only one provider key can ever be rendered

Example fix

// before
extensions:
  remote_sampling:
    adaptive:
      sampling_refresh_interval: 60s
    file:
      path: /etc/jaeger/sampling.json
// after
extensions:
  remote_sampling:
    adaptive:
      sampling_refresh_interval: 60s
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Adaptive != nil && cfg.File != nil {
    return errors.New("configure only one of remotesampling adaptive or file")
}
if err := cfg.Validate(); err != nil {
    return err
}

Type guard

func providerCount(cfg *remotesampling.Config) int {
    n := 0
    if cfg.Adaptive != nil { n++ }
    if cfg.File != nil { n++ }
    return n
} // must be exactly 1

Try / catch

if err := cfg.Validate(); err != nil {
    var startupErr component.ErrSettings
    if strings.Contains(err.Error(), "only one sampling strategy provider") {
        return fmt.Errorf("remove duplicate provider: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Configuring remotesampling with both an 'adaptive:' section and a 'file:' section in the same extension config; Validate() detects both non-nil and returns this error.

Common situations: Merging config fragments from two example files; a values/override layer (e.g. Helm) injecting the file provider while the base sets adaptive; experimenting with file-based sampling while leaving adaptive settings in place.

Related errors


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