{"record":{"id":"cbef4dddd8e570cb","repo":"thanos-io/thanos","slug":"parse-labels","errorCode":null,"errorMessage":"parse labels","messagePattern":"parse labels","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/receive.go","lineNumber":75,"sourceCode":"\t\"github.com/thanos-io/thanos/pkg/tenancy\"\n\t\"github.com/thanos-io/thanos/pkg/tls\"\n)\n\nconst (\n\tcompressionNone   = \"none\"\n\tmetricNamesFilter = \"metric-names-filter\"\n)\n\nfunc registerReceive(app *extkingpin.App) {\n\tcmd := app.Command(component.Receive.String(), \"Accept Prometheus remote write API requests and write to local tsdb.\")\n\n\tconf := &receiveConfig{}\n\tconf.registerFlag(cmd)\n\n\tcmd.Setup(func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ <-chan struct{}, debugLogging bool) error {\n\t\tlset, err := parseFlagLabels(conf.labelStrs)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"parse labels\")\n\t\t}\n\n\t\tif !model.UTF8Validation.IsValidLabelName(conf.tenantLabelName) {\n\t\t\treturn errors.Errorf(\"unsupported format for tenant label name, got %s\", conf.tenantLabelName)\n\t\t}\n\t\tif lset.Len() == 0 {\n\t\t\treturn 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.\")\n\t\t}\n\n\t\tgrpcLogOpts, logFilterMethods, err := logging.ParsegRPCOptions(conf.reqLogConfig)\n\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"error while parsing config for request logging\")\n\t\t}\n\n\t\ttsdbOpts := &tsdb.Options{\n\t\t\tMinBlockDuration:               int64(time.Duration(*conf.tsdbMinBlockDuration) / time.Millisecond),\n\t\t\tMaxBlockDuration:               int64(time.Duration(*conf.tsdbMaxBlockDuration) / time.Millisecond),","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/receive.go#L57-L93","documentation":"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.","triggerScenarios":"Thrown at cmd/thanos/receive.go:75 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the --label flags to use key=value format","Avoid reserved or invalid label names","Check for missing '=' or duplicate keys"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}