{"record":{"id":"742f71e01319fd90","repo":"thanos-io/thanos","slug":"query-configuration","errorCode":null,"errorMessage":"query configuration","messagePattern":"query configuration","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/rule.go","lineNumber":345,"sourceCode":"\ttracer opentracing.Tracer,\n\tcomp component.Component,\n\tconf ruleConfig,\n\treloadSignal <-chan struct{},\n\tflagsMap map[string]string,\n\thttpLogOpts []logging.Option,\n\tgrpcLogOpts []grpc_logging.Option,\n\tlogFilterMethods []string,\n\ttsdbOpts *tsdb.Options,\n\tagentOpts *agent.Options,\n) error {\n\tmetrics := newRuleMetrics(reg)\n\n\tvar queryCfg []clientconfig.Config\n\tvar err error\n\tif len(conf.queryConfigYAML) > 0 {\n\t\tqueryCfg, err = clientconfig.LoadConfigs(conf.queryConfigYAML)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"query configuration\")\n\t\t}\n\t} else {\n\t\tqueryCfg, err = clientconfig.BuildConfigFromHTTPAddresses(conf.query.addrs)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"query configuration\")\n\t\t}\n\n\t\t// Build the query configuration from the legacy query flags.\n\t\tvar fileSDConfigs []clientconfig.HTTPFileSDConfig\n\t\tif len(conf.query.sdFiles) > 0 {\n\t\t\tfileSDConfigs = append(fileSDConfigs, clientconfig.HTTPFileSDConfig{\n\t\t\t\tFiles:           conf.query.sdFiles,\n\t\t\t\tRefreshInterval: model.Duration(conf.query.sdInterval),\n\t\t\t})\n\t\t\tqueryCfg = append(queryCfg,\n\t\t\t\tclientconfig.Config{\n\t\t\t\t\tHTTPConfig: clientconfig.HTTPConfig{\n\t\t\t\t\t\tEndpointsConfig: clientconfig.HTTPEndpointsConfig{","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/rule.go#L327-L363","documentation":"This error wraps failures from clientconfig.LoadConfigs when loading the query API configuration YAML file for the Thanos Rule component. It is returned by runRule during startup before any query clients are created. The underlying error typically indicates the YAML file is unreadable or violates the endpoint config schema.","triggerScenarios":"The --query.config-file (conf.queryConfigYAML) flag points to a file whose YAML fails to parse or fails schema validation inside clientconfig.LoadConfigs. Only taken when len(conf.queryConfigYAML) > 0.","commonSituations":"YAML typo (bad indentation), unknown field in the endpoints/httpConfig schema, file referenced by an environment variable that is empty, or a config file mounted in Kubernetes that is malformed or truncated.","solutions":["Validate the query config YAML parses (e.g. `yamllint` or a quick Go unmarshal into clientconfig.Config) before starting rule.","Check the file path passed to --query.config-file exists and is readable by the rule process.","Compare your YAML against the documented clientconfig.Config schema; remove or fix unknown/mistyped fields (especially http_config and endpoints).","If mounted via Kubernetes Secret/ConfigMap, verify the mounted content was updated correctly."],"exampleFix":"// before\nquery:\n  config-file: /etc/thanos/query.yml\n  # file content uses unknown key 'endpoitns'\n// after\n# /etc/thanos/query.yml\nendpoints:\n  - http://query-frontend:9090","handlingStrategy":"validation","validationCode":"var probe []clientconfig.Config\nif conf.queryConfigYAML != \"\" {\n    if _, err := os.Stat(conf.queryConfigYAML); err != nil {\n        return fmt.Errorf(\"query config file missing: %w\", err)\n    }\n    if _, err := clientconfig.LoadConfigs([]string{conf.queryConfigYAML}); err != nil {\n        return fmt.Errorf(\"query config invalid: %w\", err)\n    }\n    _ = probe\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint the query config YAML in CI before deploying.","Mount config via ConfigMap and verify checksum after rollout.","Keep the config schema minimal and reference the documented example."],"tags":["thanos","config","yaml","startup"],"backgroundTag":"yaml-parse-error","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"}