{"record":{"id":"5b28656e06654b41","repo":"thanos-io/thanos","slug":"invalid-reload-method-s","errorCode":null,"errorMessage":"invalid reload method: %s","messagePattern":"invalid reload method: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/sidecar.go","lineNumber":103,"sourceCode":"\t\t}\n\n\t\topts := reloader.Options{\n\t\t\tHTTPClient:    *httpClient,\n\t\t\tCfgFile:       conf.reloader.confFile,\n\t\t\tCfgOutputFile: conf.reloader.envVarConfFile,\n\t\t\tWatchedDirs:   conf.reloader.ruleDirectories,\n\t\t\tWatchInterval: conf.reloader.watchInterval,\n\t\t\tRetryInterval: conf.reloader.retryInterval,\n\t\t}\n\n\t\tswitch conf.reloader.method {\n\t\tcase HTTPReloadMethod:\n\t\t\topts.ReloadURL = reloader.ReloadURLFromBase(conf.prometheus.url)\n\t\tcase SignalReloadMethod:\n\t\t\topts.ProcessName = conf.reloader.processName\n\t\t\topts.RuntimeInfoURL = reloader.RuntimeInfoURLFromBase(conf.prometheus.url)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"invalid reload method: %s\", conf.reloader.method)\n\t\t}\n\n\t\trl := reloader.New(log.With(logger, \"component\", \"reloader\"),\n\t\t\textprom.WrapRegistererWithPrefix(\"thanos_sidecar_\", reg),\n\t\t\t&opts)\n\n\t\treturn runSidecar(g, logger, reg, tracer, rl, component.Sidecar, *conf, httpClient, grpcLogOpts, logFilterMethods)\n\t})\n}\n\nfunc runSidecar(\n\tg *run.Group,\n\tlogger log.Logger,\n\treg *prometheus.Registry,\n\ttracer opentracing.Tracer,\n\treloader *reloader.Reloader,\n\tcomp component.Component,\n\tconf sidecarConfig,","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/sidecar.go#L85-L121","documentation":"The sidecar supports a fixed set of reload methods for making Prometheus pick up new config: the default webhook reload (HTTP POST to /-/reload) and SignalReloadMethod (sending SIGHUP). If --reload-method (conf.reloader.method) holds any other string, the Setup switch falls to default and returns fmt.Errorf(\"invalid reload method: %s\", conf.reloader.method), preventing startup.","triggerScenarios":"Starting the sidecar with --reload-method set to a value outside the supported set (e.g. 'reload', 'web', 'HTTP', or a typo like 'signel'), so the switch at cmd/thanos/sidecar.go:97-102 matches neither HTTPReloadMethod nor SignalReloadMethod.","commonSituations":"Typos or wrong casing in the flag value; automation templates passing an old/renamed method value after upgrading Thanos; users inventing values like 'post' or 'hup' not in the enum.","solutions":["Set --reload-method to exactly 'HTTP' (webhook reload via POST /-/reload) or 'signal' (SIGHUP) — check the constant definitions in cmd/thanos/sidecar.go for the exact accepted strings.","Fix casing: values are typically case-sensitive constants, so 'http' vs 'HTTP' matters.","Omit the flag entirely to use the default reload method if unsure.","Grep the source for HTTPReloadMethod / SignalReloadMethod declarations to confirm valid values for your Thanos version, as the set can change between releases."],"exampleFix":"// before\n--reload-method=hup\n// after\n--reload-method=signal","handlingStrategy":"validation","validationCode":"var validReloadMethods = map[string]bool{\"HTTP\": true, HTTPReloadMethod: true, SignalReloadMethod: true}\nfunc validReloadMethod(m string) bool { return validReloadMethods[m] }\n// check conf.reloader.method before launching sidecar","typeGuard":"null","tryCatchPattern":"switch conf.reloader.method {\ncase HTTPReloadMethod:\n    opts.ReloadURL = reloader.ReloadURLFromBase(conf.prometheus.url)\ncase SignalReloadMethod:\n    opts.ProcessName = conf.reloader.processName\n    opts.RuntimeInfoURL = reloader.RuntimeInfoURLFromBase(conf.prometheus.url)\ndefault:\n    return fmt.Errorf(\"invalid reload method %q: must be one of %v\", conf.reloader.method, []string{HTTPReloadMethod, SignalReloadMethod})\n}","preventionTips":["Always pass reload-method values exactly as the declared constants (HTTPReloadMethod / SignalReloadMethod)","Omit the flag to use the default instead of guessing a value","Add a flag choice/enum constraint in automation templates so invalid values are rejected at render time"],"tags":["go","cli","config","enum","thanos"],"backgroundTag":"invalid-enum-value","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}