thanos-io/thanos · warning
ErrFlagEndpointNotFound
ErrFlagEndpointNotFound
Error message
no flag endpoint found
What it means
ErrFlagEndpointNotFound is returned by promclient.ConfiguredFlags when Prometheus's /flags endpoint answers 404. The client uses this sentinel to signal that the connected Prometheus does not expose the flags API (old version or flag disabled), letting callers skip flag-dependent logic instead of failing.
Solutions
- Upgrade Prometheus to a version exposing /api/v1/status/flags (>= 2.13)
- Compare errors with errors.Is and skip flag-dependent logic when this sentinel is returned (sidecar already does this)
- Verify promURL points at the correct Prometheus instance
- Check whether a proxy/ingress strips the status endpoints
Example fix
// before
if flags, flagErr = client.ConfiguredFlags(ctx, m.promURL); flagErr != nil {
return errors.Wrapf(flagErr, "fetch Prometheus flags")
}
// after
if flags, flagErr = client.ConfiguredFlags(ctx, m.promURL); flagErr != nil && !errors.Is(flagErr, promclient.ErrFlagEndpointNotFound) {
return errors.Wrapf(flagErr, "fetch Prometheus flags")
} Defensive patterns
Strategy: fallback
Type guard
func isFlagEndpointNotFound(err error) bool {
return errors.Is(err, promclient.ErrFlagEndpointNotFound)
} Try / catch
flags, err := client.ConfiguredFlags(ctx, promURL)
if errors.Is(err, promclient.ErrFlagEndpointNotFound) {
log.Warn("Prometheus does not expose /flags; skipping flag validation")
return nil
} Prevention
- Run Prometheus >= 2.13 where /api/v1/status/flags exists
- Always compare with errors.Is against the sentinel, not string matching
- Verify promURL resolves to the actual Prometheus process
When it happens
Trigger: ConfiguredFlags(ctx, promURL) receiving HTTP 404 from Prometheus's /api/v1/status/flags endpoint; sidecar retry loop explicitly ignores this sentinel (err != promclient.ErrFlagEndpointNotFound).
Common situations: Sidecar pointed at Prometheus < 2.13 (no /flags endpoint); monitoring scrape configs disabling the status API; misconfigured promURL pointing at a non-Prometheus service.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- failed to validate prometheus flags
- failed to get prometheus version
- initial external labels query
- perform request against
- expected 2xx response, got
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/e3a2d1fd4b1b9915.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/promclient/promclient.go:49
"github.com/prometheus/prometheus/model/timestamp"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/promql/parser"
"google.golang.org/grpc/codes"
"gopkg.in/yaml.v2"
"github.com/thanos-io/thanos/pkg/clientconfig"
"github.com/thanos-io/thanos/pkg/exemplars/exemplarspb"
"github.com/thanos-io/thanos/pkg/metadata/metadatapb"
"github.com/thanos-io/thanos/pkg/rules/rulespb"
"github.com/thanos-io/thanos/pkg/runutil"
"github.com/thanos-io/thanos/pkg/status/statuspb"
"github.com/thanos-io/thanos/pkg/store/storepb"
"github.com/thanos-io/thanos/pkg/targets/targetspb"
"github.com/thanos-io/thanos/pkg/tracing"
)
var (
ErrFlagEndpointNotFound = errors.New("no flag endpoint found")
statusToCode = map[int]codes.Code{
http.StatusBadRequest: codes.InvalidArgument,
http.StatusNotFound: codes.NotFound,
http.StatusUnprocessableEntity: codes.Internal,
http.StatusServiceUnavailable: codes.Unavailable,
http.StatusInternalServerError: codes.Internal,
}
)
const (
SUCCESS = "success"
)
// HTTPClient sends an HTTP request and returns the response.
type HTTPClient interface {
Do(*http.Request) (*http.Response, error)
}View on GitHub (pinned to 35b8b99117)