thanos-io/thanos · error

parse labels

Error message

parse labels

What it means

Wraps a failure of parseFlagLabels while the receive component is starting up: one of the external label strings passed via --label could not be parsed into a valid Prometheus label pair (bad syntax, duplicate names, or invalid label name/value). The offending flag value is the input at fault; startup aborts because receive requires unique identifying external labels.

Solutions

  1. Fix the --label flags to use key=value format
  2. Avoid reserved or invalid label names
  3. Check for missing '=' or duplicate keys
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/thanos/receive.go:75 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at cmd/thanos/receive.go:75

	"github.com/thanos-io/thanos/pkg/tenancy"
	"github.com/thanos-io/thanos/pkg/tls"
)

const (
	compressionNone   = "none"
	metricNamesFilter = "metric-names-filter"
)

func registerReceive(app *extkingpin.App) {
	cmd := app.Command(component.Receive.String(), "Accept Prometheus remote write API requests and write to local tsdb.")

	conf := &receiveConfig{}
	conf.registerFlag(cmd)

	cmd.Setup(func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ <-chan struct{}, debugLogging bool) error {
		lset, err := parseFlagLabels(conf.labelStrs)
		if err != nil {
			return errors.Wrap(err, "parse labels")
		}

		if !model.UTF8Validation.IsValidLabelName(conf.tenantLabelName) {
			return errors.Errorf("unsupported format for tenant label name, got %s", conf.tenantLabelName)
		}
		if lset.Len() == 0 {
			return errors.New("no external labels configured for receive, uniquely identifying external labels must be configured (ideally with `receive_` prefix); see https://thanos.io/tip/thanos/storage.md#external-labels for details.")
		}

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

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

		tsdbOpts := &tsdb.Options{
			MinBlockDuration:               int64(time.Duration(*conf.tsdbMinBlockDuration) / time.Millisecond),
			MaxBlockDuration:               int64(time.Duration(*conf.tsdbMaxBlockDuration) / time.Millisecond),

View on GitHub (pinned to 35b8b99117)