{"record":{"id":"358d3c4cc5438f21","repo":"jaegertracing/jaeger","slug":"only-one-sampling-strategy-provider-can-be-specifi","errorCode":null,"errorMessage":"only one sampling strategy provider can be specified, 'adaptive' or 'file'","messagePattern":"only one sampling strategy provider can be specified, 'adaptive' or 'file'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/remotesampling/config.go","lineNumber":22,"sourceCode":"package remotesampling\n\nimport (\n\t\"errors\"\n\t\"time\"\n\n\t\"github.com/asaskevich/govalidator\"\n\t\"go.opentelemetry.io/collector/component\"\n\t\"go.opentelemetry.io/collector/config/configgrpc\"\n\t\"go.opentelemetry.io/collector/config/confighttp\"\n\t\"go.opentelemetry.io/collector/config/configoptional\"\n\t\"go.opentelemetry.io/collector/confmap\"\n\n\t\"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy/adaptive\"\n)\n\nvar (\n\terrNoProvider        = errors.New(\"no sampling strategy provider specified, expecting 'adaptive' or 'file'\")\n\terrMultipleProviders = errors.New(\"only one sampling strategy provider can be specified, 'adaptive' or 'file'\")\n\terrNegativeInterval  = errors.New(\"reload interval must be a positive value, or zero to disable automatic reloading\")\n)\n\nvar (\n\t_ component.Config  = (*Config)(nil)\n\t_ confmap.Validator = (*Config)(nil)\n)\n\ntype Config struct {\n\tFile     configoptional.Optional[FileConfig]              `mapstructure:\"file\"`\n\tAdaptive configoptional.Optional[AdaptiveConfig]          `mapstructure:\"adaptive\"`\n\tHTTP     configoptional.Optional[confighttp.ServerConfig] `mapstructure:\"http\"`\n\tGRPC     configoptional.Optional[configgrpc.ServerConfig] `mapstructure:\"grpc\"`\n}\n\ntype FileConfig struct {\n\t// File specifies a local file as the source of sampling strategies.\n\tPath string `mapstructure:\"path\"`","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/remotesampling/config.go#L4-L40","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove one of the two provider blocks ('adaptive:' or 'file:') from the remotesampling extension config","Keep only the provider you actually intend to serve; move the other strategy to a separate collector instance if both are needed","Template your Helm/collector configs so only one provider key can ever be rendered"],"exampleFix":"// before\nextensions:\n  remote_sampling:\n    adaptive:\n      sampling_refresh_interval: 60s\n    file:\n      path: /etc/jaeger/sampling.json\n// after\nextensions:\n  remote_sampling:\n    adaptive:\n      sampling_refresh_interval: 60s","handlingStrategy":"validation","validationCode":"if cfg.Adaptive != nil && cfg.File != nil {\n    return errors.New(\"configure only one of remotesampling adaptive or file\")\n}\nif err := cfg.Validate(); err != nil {\n    return err\n}","typeGuard":"func providerCount(cfg *remotesampling.Config) int {\n    n := 0\n    if cfg.Adaptive != nil { n++ }\n    if cfg.File != nil { n++ }\n    return n\n} // must be exactly 1","tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    var startupErr component.ErrSettings\n    if strings.Contains(err.Error(), \"only one sampling strategy provider\") {\n        return fmt.Errorf(\"remove duplicate provider: %w\", err)\n    }\n    return err\n}","preventionTips":["Keep only one provider block per remotesampling extension","Beware Helm/base+override layering adding both providers","Lint configs to reject both keys simultaneously"],"tags":["go","config","sampling","validation"],"backgroundTag":"conflicting-config-options","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}