{"record":{"id":"90acf8cbbe51a673","repo":"thanos-io/thanos","slug":"no-query-api-server-reachable","errorCode":null,"errorMessage":"no query API server reachable","messagePattern":"no query API server reachable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/rule.go","lineNumber":1053,"sourceCode":"\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlevel.Error(logger).Log(\"err\", err, \"query\", qs)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings := make([]string, 0, len(result.Warnings))\n\t\t\t\t\tfor _, warn := range result.Warnings {\n\t\t\t\t\t\twarnings = append(warnings, warn.Error())\n\t\t\t\t\t}\n\t\t\t\t\twarnings = filterOutPromQLWarnings(warnings, logger, qs)\n\t\t\t\t\tif len(warnings) > 0 {\n\t\t\t\t\t\truleEvalWarnings.WithLabelValues(strings.ToLower(partialResponseStrategy.String())).Inc()\n\t\t\t\t\t\tlevel.Warn(logger).Log(\"warnings\", strings.Join(warnings, \", \"), \"query\", qs)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn v, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil, errors.Errorf(\"no query API server reachable\")\n\t\t}\n\t}\n}\n\nfunc addDiscoveryGroups(g *run.Group, c *clientconfig.HTTPClient, interval time.Duration, logger log.Logger) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tg.Add(func() error {\n\t\tc.Discover(ctx)\n\t\treturn nil\n\t}, func(error) {\n\t\tcancel()\n\t})\n\n\tg.Add(func() error {\n\t\trunutil.RepeatInfinitely(logger, interval, ctx.Done(), func() error {\n\t\t\treturn c.Resolve(ctx)\n\t\t})\n\t\treturn nil","sourceCodeStart":1035,"sourceCodeEnd":1071,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/rule.go#L1035-L1071","documentation":"The rule component builds a query client by iterating configured query API endpoints (--query / --query-url) and returns errors.Errorf(\"no query API server reachable\") when none of the configured endpoints succeeded the clientCreation check. Without a reachable Querier the rule evaluator cannot run queries, so startup of the query-pool fails.","triggerScenarios":"All --query addresses are unreachable, DNS-unresolvable, or reject connections at rule startup; the query address list ends up empty after discovery filtering.","commonSituations":"Querier pod not yet up when Rule starts (ordering in the same manifest); wrong --query host/port; network policy or service name typo in Kubernetes; Querier replicas all down.","solutions":["Verify each --query address with curl (http://<host>:<port>/-/ready) from the rule pod.","Correct DNS/service names and ports in --query / --query-url flags.","Ensure Querier replicas are running and reachable (network policies, service selectors).","Provide multiple query endpoints or rely on discovery groups so one failure doesn't kill the pool; restart Rule after Querier is up."],"exampleFix":"// before\nthanos rule --query=querier.monitoring.svc:9999        # wrong port\n// after\nthanos rule --query=querier.monitoring.svc:9090","handlingStrategy":"retry","validationCode":"# from the rule pod, before start:\nfor q in $QUERY_ENDPOINTS; do curl -sf \"http://$q/-/ready\" || exit 1; done","typeGuard":null,"tryCatchPattern":"// re-create the query pool with backoff\nerr := buildQueryPool(...)\nfor errors.Cause(err).Error() == \"no query API server reachable\" && attempts < max {\n  time.Sleep(backoff); err = buildQueryPool(...)\n}","preventionTips":["Configure multiple query endpoints for redundancy","Verify service DNS names and ports before deploy","Ensure Querier readiness precedes Rule startup (init containers / ordering)","Check NetworkPolicies allow rule -> querier traffic"],"tags":["network","grpc","query","startup"],"backgroundTag":"connection-refused","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"}