{"record":{"id":"e3a2d1fd4b1b9915","repo":"thanos-io/thanos","slug":"errflagendpointnotfound","errorCode":"ErrFlagEndpointNotFound","errorMessage":"no flag endpoint found","messagePattern":"no flag endpoint found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/promclient/promclient.go","lineNumber":49,"sourceCode":"\t\"github.com/prometheus/prometheus/model/timestamp\"\n\t\"github.com/prometheus/prometheus/promql\"\n\t\"github.com/prometheus/prometheus/promql/parser\"\n\t\"google.golang.org/grpc/codes\"\n\t\"gopkg.in/yaml.v2\"\n\n\t\"github.com/thanos-io/thanos/pkg/clientconfig\"\n\t\"github.com/thanos-io/thanos/pkg/exemplars/exemplarspb\"\n\t\"github.com/thanos-io/thanos/pkg/metadata/metadatapb\"\n\t\"github.com/thanos-io/thanos/pkg/rules/rulespb\"\n\t\"github.com/thanos-io/thanos/pkg/runutil\"\n\t\"github.com/thanos-io/thanos/pkg/status/statuspb\"\n\t\"github.com/thanos-io/thanos/pkg/store/storepb\"\n\t\"github.com/thanos-io/thanos/pkg/targets/targetspb\"\n\t\"github.com/thanos-io/thanos/pkg/tracing\"\n)\n\nvar (\n\tErrFlagEndpointNotFound = errors.New(\"no flag endpoint found\")\n\n\tstatusToCode = map[int]codes.Code{\n\t\thttp.StatusBadRequest:          codes.InvalidArgument,\n\t\thttp.StatusNotFound:            codes.NotFound,\n\t\thttp.StatusUnprocessableEntity: codes.Internal,\n\t\thttp.StatusServiceUnavailable:  codes.Unavailable,\n\t\thttp.StatusInternalServerError: codes.Internal,\n\t}\n)\n\nconst (\n\tSUCCESS = \"success\"\n)\n\n// HTTPClient sends an HTTP request and returns the response.\ntype HTTPClient interface {\n\tDo(*http.Request) (*http.Response, error)\n}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/promclient/promclient.go#L31-L67","documentation":"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.","triggerScenarios":"ConfiguredFlags(ctx, promURL) receiving HTTP 404 from Prometheus's /api/v1/status/flags endpoint; sidecar retry loop explicitly ignores this sentinel (err != promclient.ErrFlagEndpointNotFound).","commonSituations":"Sidecar pointed at Prometheus < 2.13 (no /flags endpoint); monitoring scrape configs disabling the status API; misconfigured promURL pointing at a non-Prometheus service.","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"],"exampleFix":"// before\nif flags, flagErr = client.ConfiguredFlags(ctx, m.promURL); flagErr != nil {\n    return errors.Wrapf(flagErr, \"fetch Prometheus flags\")\n}\n// after\nif flags, flagErr = client.ConfiguredFlags(ctx, m.promURL); flagErr != nil && !errors.Is(flagErr, promclient.ErrFlagEndpointNotFound) {\n    return errors.Wrapf(flagErr, \"fetch Prometheus flags\")\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":"func isFlagEndpointNotFound(err error) bool {\n    return errors.Is(err, promclient.ErrFlagEndpointNotFound)\n}","tryCatchPattern":"flags, err := client.ConfiguredFlags(ctx, promURL)\nif errors.Is(err, promclient.ErrFlagEndpointNotFound) {\n    log.Warn(\"Prometheus does not expose /flags; skipping flag validation\")\n    return nil\n}","preventionTips":["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"],"tags":["http","prometheus","compatibility"],"backgroundTag":"resource-not-found","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"}