{"record":{"id":"35d3c95c1be45bfe","repo":"thanos-io/thanos","slug":"error-while-parsing-tsdb-selector-configuration","errorCode":null,"errorMessage":"error while parsing tsdb selector configuration","messagePattern":"error while parsing tsdb selector configuration","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/query.go","lineNumber":261,"sourceCode":"\t\t\treturn errors.Wrap(err, \"error while parsing config for request logging\")\n\t\t}\n\n\t\tgrpcLogOpts, logFilterMethods, err := logging.ParsegRPCOptions(reqLogConfig)\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\tif *webRoutePrefix == \"\" {\n\t\t\t*webRoutePrefix = *webExternalPrefix\n\t\t}\n\n\t\tif *webRoutePrefix != *webExternalPrefix {\n\t\t\tlevel.Warn(logger).Log(\"msg\", \"different values for --web.route-prefix and --web.external-prefix detected, web UI may not work without a reverse-proxy.\")\n\t\t}\n\n\t\ttsdbRelabelConfig, err := storeSelectorRelabelConf.Content()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"error while parsing tsdb selector configuration\")\n\t\t}\n\t\ttsdbSelector, err := block.ParseRelabelConfig(tsdbRelabelConfig, block.SelectorSupportedRelabelActions)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdialOpts, err := grpcClientConfig.dialOptions(logger, reg, tracer)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif grpcClientConfig.secure || grpcClientConfig.skipVerify || grpcClientConfig.cert != \"\" || grpcClientConfig.key != \"\" || grpcClientConfig.caCert != \"\" || grpcClientConfig.serverName != \"\" {\n\t\t\tlevel.Warn(logger).Log(\"msg\", \"--grpc-client-tls-* flags are deprecated and will be removed after v0.43.0, use default_client_config in endpoint.sd-config-file instead\")\n\t\t}\n\n\t\t// remove this when the deprecated flags are removed, as the endpoint set will be the only way to configure store endpoints.\n\t\tglobalTLSOpt, err := extgrpc.StoreClientTLSCredentials(logger, grpcClientConfig.secure, grpcClientConfig.skipVerify, grpcClientConfig.cert, grpcClientConfig.key, grpcClientConfig.caCert, grpcClientConfig.serverName, grpcClientConfig.minTLSVersion)\n\t\tif err != nil {","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/query.go#L243-L279","documentation":"The query command converts the --store-selector-relabel-config (or --store.sd-relabel-config style) flag content into a YAML relabel config via storeSelectorRelabelConf.Content() and validates it against block.SelectorSupportedRelabelActions; invalid YAML or unsupported relabel actions produce \"error while parsing tsdb selector configuration\".","triggerScenarios":"Supplying a relabel config string that is not valid YAML, or containing relabel actions not in SelectorSupportedRelabelActions (unsupported action types for store selection), when starting `thanos query`.","commonSituations":"Multi-line flag values mangled by the shell or Kubernetes args arrays, use of actions like `hashmod` with wrong modulus fields, or copy-pasted Prometheus relabel configs containing unsupported actions.","solutions":["Validate the YAML relabel config locally (promtool check config or yaml.Unmarshal into relabel.Config).","Ensure only selector-supported relabel actions are used; check block.SelectorSupportedRelabelActions for your version.","Quote multi-line flag values properly: use `--store-selector-relabel-config='<yaml>'` with newlines preserved.","Confirm each rule has valid source_labels, target_label, regex, and action fields."],"exampleFix":"// before\n--store-selector-relabel-config='{\"action\":\"drop\"}'  // JSON, missing regex/fields\n// after\n--store-selector-relabel-config='\n- action: drop\n  regex: \"blacklisted.*\"\n  source_labels: [cluster]\n'","handlingStrategy":"validation","validationCode":"conf, err := yamlContent.ToYAML() // and\nif _, err := relabel.ParseFlags(relabelConf); err != nil {\n    return fmt.Errorf(\"invalid store selector relabel config: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if _, err := block.ParseRelabelConfig(content, block.SelectorSupportedRelabelActions); err != nil {\n    return fmt.Errorf(\"unsupported selector relabel config: %w\", err)\n}","preventionTips":["Write relabel configs as YAML, never JSON","Only use relabel actions listed in SelectorSupportedRelabelActions","Heredoc or file-mount multi-line flag values to avoid shell mangling","Check the relabel config with promtool before deploy"],"tags":["yaml","relabel","configuration"],"backgroundTag":"invalid-config-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"}