thanos-io/thanos · error

invalid reload method

Error message

invalid reload method: %s

What it means

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.

Solutions

  1. 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.
  2. Fix casing: values are typically case-sensitive constants, so 'http' vs 'HTTP' matters.
  3. Omit the flag entirely to use the default reload method if unsure.
  4. Grep the source for HTTPReloadMethod / SignalReloadMethod declarations to confirm valid values for your Thanos version, as the set can change between releases.

Example fix

// before
--reload-method=hup
// after
--reload-method=signal
Defensive patterns

Strategy: validation

Validate before calling

var validReloadMethods = map[string]bool{"HTTP": true, HTTPReloadMethod: true, SignalReloadMethod: true}
func validReloadMethod(m string) bool { return validReloadMethods[m] }
// check conf.reloader.method before launching sidecar

Type guard

null

Try / catch

switch conf.reloader.method {
case HTTPReloadMethod:
    opts.ReloadURL = reloader.ReloadURLFromBase(conf.prometheus.url)
case SignalReloadMethod:
    opts.ProcessName = conf.reloader.processName
    opts.RuntimeInfoURL = reloader.RuntimeInfoURLFromBase(conf.prometheus.url)
default:
    return fmt.Errorf("invalid reload method %q: must be one of %v", conf.reloader.method, []string{HTTPReloadMethod, SignalReloadMethod})
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/5b28656e06654b41. Report an issue: GitHub.

Appendix: source

Thrown at cmd/thanos/sidecar.go:103

		}

		opts := reloader.Options{
			HTTPClient:    *httpClient,
			CfgFile:       conf.reloader.confFile,
			CfgOutputFile: conf.reloader.envVarConfFile,
			WatchedDirs:   conf.reloader.ruleDirectories,
			WatchInterval: conf.reloader.watchInterval,
			RetryInterval: conf.reloader.retryInterval,
		}

		switch conf.reloader.method {
		case HTTPReloadMethod:
			opts.ReloadURL = reloader.ReloadURLFromBase(conf.prometheus.url)
		case SignalReloadMethod:
			opts.ProcessName = conf.reloader.processName
			opts.RuntimeInfoURL = reloader.RuntimeInfoURLFromBase(conf.prometheus.url)
		default:
			return fmt.Errorf("invalid reload method: %s", conf.reloader.method)
		}

		rl := reloader.New(log.With(logger, "component", "reloader"),
			extprom.WrapRegistererWithPrefix("thanos_sidecar_", reg),
			&opts)

		return runSidecar(g, logger, reg, tracer, rl, component.Sidecar, *conf, httpClient, grpcLogOpts, logFilterMethods)
	})
}

func runSidecar(
	g *run.Group,
	logger log.Logger,
	reg *prometheus.Registry,
	tracer opentracing.Tracer,
	reloader *reloader.Reloader,
	comp component.Component,
	conf sidecarConfig,

View on GitHub (pinned to 35b8b99117)