thanos-io/thanos · error

error while parsing config for request logging

Error message

error while parsing config for request logging

What it means

At sidecar startup, Thanos parses the request-logging configuration (--request-logging-config / reqLogConfig) with logging.ParsegRPCOptions to derive gRPC logging options and filtered methods. If that config string is invalid JSON/YAML or structurally wrong, the setup function aborts with "error while parsing config for request logging" and the sidecar refuses to start.

Solutions

  1. Validate the request-logging config content: it must be valid JSON/YAML with a supported log level (debug, info, error) and valid gRPC method patterns.
  2. Fix quoting/escaping of the flag value in your manifest or systemd unit — multi-line JSON often breaks shell quoting.
  3. Temporarily remove --request-logging-config to confirm the error is isolated to that flag, then re-add a minimal valid config.
  4. Read the wrapped ParsegRPCOptions error in the message for the exact offending field or method entry.

Example fix

// before
--request-logging-config='{"level": "verbose"}'
// after
--request-logging-config='{"level": "debug"}'
Defensive patterns

Strategy: validation

Validate before calling

func validReqLogConfig(cfg string) error {
    var opts map[string]interface{}
    return json.Unmarshal([]byte(cfg), &opts) // syntax check; level/method validation per logging docs
}

Type guard

null

Try / catch

grpcLogOpts, logFilterMethods, err := logging.ParsegRPCOptions(conf.reqLogConfig)
if err != nil {
    logger.Error("invalid --request-logging-config", "err", err)
    return fmt.Errorf("invalid --request-logging-config: %w", err)
}

Prevention

When it happens

Trigger: Running the sidecar with a --request-logging-config flag (or the corresponding conf.reqLogConfig content) that ParsegRPCOptions cannot parse — malformed JSON, unknown log level, or an entry that isn't a valid gRPC method pattern.

Common situations: Typos in the inline JSON config passed via flag; Kubernetes manifests quoting/escaping the YAML incorrectly so the flag value is mangled; specifying a level other than the supported levels (e.g. debug/info/error) or an invalid method filter.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at cmd/thanos/sidecar.go:70

	"github.com/thanos-io/thanos/pkg/shipper"
	"github.com/thanos-io/thanos/pkg/status"
	"github.com/thanos-io/thanos/pkg/store"
	"github.com/thanos-io/thanos/pkg/store/labelpb"
	"github.com/thanos-io/thanos/pkg/store/storepb"
	"github.com/thanos-io/thanos/pkg/targets"
	"github.com/thanos-io/thanos/pkg/tls"
)

func registerSidecar(app *extkingpin.App) {
	cmd := app.Command(component.Sidecar.String(), "Sidecar for Prometheus server.")
	conf := &sidecarConfig{}
	conf.registerFlag(cmd)
	cmd.Setup(func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ <-chan struct{}, _ bool) error {

		grpcLogOpts, logFilterMethods, err := logging.ParsegRPCOptions(conf.reqLogConfig)

		if err != nil {
			return errors.Wrap(err, "error while parsing config for request logging")
		}

		httpConfContentYaml, err := conf.prometheus.httpClient.Content()
		if err != nil {
			return errors.Wrap(err, "getting http client config")
		}
		httpClientConfig, err := clientconfig.NewHTTPClientConfigFromYAML(httpConfContentYaml)
		if err != nil {
			return errors.Wrap(err, "parsing http config YAML")
		}

		httpClient, err := clientconfig.NewHTTPClient(*httpClientConfig, "thanos-sidecar")
		if err != nil {
			return errors.Wrap(err, "Improper http client config")
		}

		opts := reloader.Options{
			HTTPClient:    *httpClient,

View on GitHub (pinned to 35b8b99117)