{"record":{"id":"f035a99a9fe1d3a2","repo":"jaegertracing/jaeger","slug":"no-sampling-strategy-provider-specified-expecting","errorCode":null,"errorMessage":"no sampling strategy provider specified, expecting 'adaptive' or 'file'","messagePattern":"no sampling strategy provider specified, expecting 'adaptive' or 'file'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/remotesampling/config.go","lineNumber":21,"sourceCode":"\npackage 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.","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/remotesampling/config.go#L3-L39","documentation":"errNoProvider is returned by Config.Validate in the remote sampling extension when neither the 'adaptive' nor the 'file' sampling strategy provider is configured. The extension must know which strategy source to serve to clients, so an empty provider section is a configuration error.","triggerScenarios":"Starting the jaeger collector extension with remotesampling config where both 'adaptive' and 'file' blocks are absent or empty; Validate() checks exactly one provider is set and fails if zero are.","commonSituations":"Deploying the OTLP-based jaeger binary with a remotesampling extension stanza that only sets http/server config but omits the provider; copying an example config and deleting the file block; upgrading from an older config format that put the provider elsewhere.","solutions":["Add either a 'file:' block (with the strategy file path) or an 'adaptive:' block to the remotesampling extension config","If you don't need remote sampling, remove the remotesampling extension from the service extensions list and its reference from the pipelines extensions","Run `jaeger validate` or your collector config validator before deploying to catch this at startup config time"],"exampleFix":"// before\nextensions:\n  remote_sampling:\n    http:\n      endpoint: 0.0.0.0:5778\n// after\nextensions:\n  remote_sampling:\n    file:\n      path: /etc/jaeger/sampling.json\n    http:\n      endpoint: 0.0.0.0:5778","handlingStrategy":"validation","validationCode":"// validate config before starting the extension\ncfg := &remotesampling.Config{}\nif cfg.Adaptive == nil && cfg.File == nil {\n    return fmt.Errorf(\"remotesampling requires either 'adaptive' or 'file' provider\")\n}\nif err := cfg.Validate(); err != nil {\n    return err\n}","typeGuard":"func hasProvider(cfg *remotesampling.Config) bool {\n    return cfg.Adaptive != nil || cfg.File != nil\n}","tryCatchPattern":"if err := ext.Start(ctx, host); err != nil {\n    if strings.Contains(err.Error(), \"no sampling strategy provider specified\") {\n        return fmt.Errorf(\"fix remotesampling config: %w\", err)\n    }\n    return err\n}","preventionTips":["Always define exactly one of adaptive/file in the remotesampling extension config","Validate collector configs in CI before deployment","Use config templates that default to the file provider"],"tags":["go","config","sampling","validation"],"backgroundTag":"missing-required-config","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}