{"record":{"id":"9cac1ed60d57029e","repo":"jaegertracing/jaeger","slug":"reload-interval-must-be-a-positive-value-or-zero","errorCode":null,"errorMessage":"reload interval must be a positive value, or zero to disable automatic reloading","messagePattern":"reload interval must be a positive value, or zero to disable automatic reloading","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/remotesampling/config.go","lineNumber":23,"sourceCode":"\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\"`\n\t// ReloadInterval is the time interval to check and reload sampling strategies file","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/remotesampling/config.go#L5-L41","documentation":"errNegativeInterval is returned by Config.Validate when a provider's reload interval is set to a negative duration. The interval controls automatic reloading of the sampling strategy and must be positive, or zero to disable reloading entirely.","triggerScenarios":"Setting 'reload_interval' (file provider) or 'sampling_refresh_interval' (adaptive provider) to a negative duration such as -5s or -1m in the remotesampling extension config.","commonSituations":"YAML arithmetic or environment-variable substitution producing a negative value; misunderstanding that 0 disables reloading and assuming negative means 'always reload'; typo like '-1' intended as a placeholder.","solutions":["Set the interval to a positive duration (e.g. 5s, 1m) to enable periodic reloading","Set it explicitly to 0 if you want the strategy loaded once with no automatic reload","Check any env-var interpolation or templating that could turn the value negative, e.g. `RELOAD_INTERVAL=-1`"],"exampleFix":"// before\nextensions:\n  remote_sampling:\n    file:\n      path: /etc/jaeger/sampling.json\n      reload_interval: -1m\n// after\nextensions:\n  remote_sampling:\n    file:\n      path: /etc/jaeger/sampling.json\n      reload_interval: 1m","handlingStrategy":"validation","validationCode":"if cfg.File != nil && cfg.File.ReloadInterval < 0 {\n    return errors.New(\"reload_interval must be >= 0\")\n}\nif err := cfg.Validate(); err != nil {\n    return err\n}","typeGuard":"func validInterval(d time.Duration) bool {\n    return d >= 0\n}","tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"reload interval must be a positive value\") {\n        return fmt.Errorf(\"check reload_interval value: %w\", err)\n    }\n    return err\n}","preventionTips":["Use 0 explicitly to disable reloading, never a negative value","Check env-var interpolation for sign flips","Add unit tests for parsed durations from config"],"tags":["go","config","sampling","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}