thanos-io/thanos · error
request config against
Error message
request config against %s
What it means
ConfiguredFlags performs the HTTP GET to /api/v1/status/flags using the client's Do method; when the request fails at the transport level (connection refused, DNS failure, timeout, TLS error), the error is wrapped with 'request config against <url>' naming the exact URL attempted.
Solutions
- Check connectivity to the URL in the error: curl http://prometheus:9090/api/v1/status/flags
- Verify the Prometheus address/port in configuration
- Check DNS resolution and NetworkPolicies/firewall rules
- Increase the request context timeout if deadlines are too short
- Fix TLS certificates/CA config if the endpoint uses HTTPS
Example fix
// before --prometheus.url=http://localhost:9090 # sidecar runs in another pod // after (kubernetes) --prometheus.url=http://prometheus-linked.default.svc:9090
Defensive patterns
Strategy: retry
Validate before calling
conn, err := net.DialTimeout("tcp", "prometheus:9090", 2*time.Second)
if err != nil {
return fmt.Errorf("prometheus unreachable before request: %w", err)
}
conn.Close() Try / catch
flags, err := client.ConfiguredFlags(ctx, u)
if err != nil {
if isNetError(err) { // strings.Contains "connect", "refused", "timeout"
// retry with exponential backoff
}
return err
} Prevention
- Verify Prometheus address/port with curl before deployment
- Use Kubernetes service DNS names, not localhost, across pods
- Set generous request timeouts on the context
- Check NetworkPolicies allow sidecar-to-Prometheus traffic
When it happens
Trigger: c.Do(req.WithContext(ctx)) returns a non-nil error — Prometheus unreachable, wrong host/port, connection refused, TLS handshake failure, or context deadline exceeded during the call. Called by an anonymous caller fetching Prometheus flags.
Common situations: Prometheus not running or listening on a different port; DNS/service name wrong inside Kubernetes ('http://prometheus:9090' vs actual service); network policy blocking the sidecar; mTLS/TLS misconfiguration; request canceled by context timeout.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- failed to validate prometheus flags
- perform request against
- read query instant response
- read query range response
- request metric against
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/f260c6f566b6d8aa.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/promclient/promclient.go:306
}
// ConfiguredFlags returns configured flags from /api/v1/status/flags Prometheus endpoint.
// Added to Prometheus from v2.2.
func (c *Client) ConfiguredFlags(ctx context.Context, base *url.URL) (Flags, error) {
u := *base
u.Path = path.Join(u.Path, "/api/v1/status/flags")
req, err := http.NewRequest(http.MethodGet, u.String(), nil)
if err != nil {
return Flags{}, errors.Wrap(err, "create request")
}
span, ctx := tracing.StartSpan(ctx, "/prom_flags HTTP[client]")
defer span.Finish()
resp, err := c.Do(req.WithContext(ctx))
if err != nil {
return Flags{}, errors.Wrapf(err, "request config against %s", u.String())
}
defer runutil.ExhaustCloseWithLogOnErr(c.logger, resp.Body, "query body")
b, err := io.ReadAll(resp.Body)
if err != nil {
return Flags{}, errors.New("failed to read body")
}
switch resp.StatusCode {
case 404:
return Flags{}, ErrFlagEndpointNotFound
case 200:
var d struct {
Data Flags `json:"data"`
}
if err := json.Unmarshal(b, &d); err != nil {
return Flags{}, errors.Wrapf(err, "unmarshal response: %v", string(b))View on GitHub (pinned to 35b8b99117)