{"record":{"id":"c6ccf62f2d04b472","repo":"thanos-io/thanos","slug":"retrieving-metadata","errorCode":null,"errorMessage":"retrieving metadata","messagePattern":"retrieving metadata","errorType":"http","errorClass":"ApiError","httpStatus":500,"severity":"error","filePath":"pkg/api/query/v1.go","lineNumber":1681,"sourceCode":"\t\t\tLimit:                   -1,\n\t\t\tMetric:                  r.URL.Query().Get(\"metric\"),\n\t\t\tPartialResponseStrategy: ps,\n\t\t}\n\n\t\tlimitStr := r.URL.Query().Get(\"limit\")\n\t\tif limitStr != \"\" {\n\t\t\tlimit, err := strconv.ParseInt(limitStr, 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, &api.ApiError{Typ: api.ErrorBadData, Err: errors.Errorf(\"invalid metric metadata limit='%v'\", limit)}, func() {}\n\t\t\t}\n\t\t\treq.Limit = int32(limit)\n\t\t}\n\n\t\ttracing.DoInSpan(ctx, \"retrieve_metadata\", func(ctx context.Context) {\n\t\t\tt, warnings, err = client.MetricMetadata(ctx, req)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, nil, &api.ApiError{Typ: api.ErrorInternal, Err: errors.Wrap(err, \"retrieving metadata\")}, func() {}\n\t\t}\n\n\t\treturn t, warnings.AsErrors(), nil, func() {}\n\t}\n}\n\nfunc (qapi *QueryAPI) tsdbStatus(r *http.Request) (any, []error, *api.ApiError, func()) {\n\tspan, ctx := tracing.StartSpan(r.Context(), \"tsdb_statistics_query_request\")\n\tdefer span.Finish()\n\n\tif err := r.ParseForm(); err != nil {\n\t\treturn nil, nil, &api.ApiError{Typ: api.ErrorInternal, Err: errors.Wrap(err, \"parse form\")}, func() {}\n\t}\n\n\tps := storepb.PartialResponseStrategy_ABORT\n\tif qapi.enableStatusPartialResponse {\n\t\tps = storepb.PartialResponseStrategy_WARN\n\t}","sourceCodeStart":1663,"sourceCodeEnd":1699,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/api/query/v1.go#L1663-L1699","documentation":"Wraps any failure from the store client's MetricMetadata gRPC call during /api/v1/metadata handling. It is classified as an internal error (ErrorInternal), meaning the query-side plumbing failed rather than the request being bad.","triggerScenarios":"The store/storeAPI backing the querier returns an error or the RPC fails while fetching metric metadata (network drop, store unavailable, store-side limit/parse errors).","commonSituations":"Store gateway down or restarting, network partitions between querier and store, timeouts on large metadata sets, store nodes returning gRPC errors.","solutions":["Check querier-to-store connectivity and that store gateways are healthy (`thanos tools bucket verify`, store /-/healthy).","Inspect querier logs for the wrapped root cause; retry the request.","Verify store gRPC services are registered and the Querier's store address set includes reachable endpoints."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"const resp = await fetch(`${base}/api/v1/metadata?limit=100`);\nif (!resp.ok) {\n  const body = await resp.json();\n  if (body.errorType === 'internal') {\n    // check store health, then retry with backoff\n    await sleep(backoff);\n    return retry();\n  }\n  throw new Error(body.error);\n}","preventionTips":["Monitor store gateway health and querier-store connectivity.","Set generous gRPC timeouts for metadata calls.","Alert on store node restarts/OOMs."],"tags":["grpc","metadata","internal-error","store-client"],"backgroundTag":"api-error-response","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"}