{"record":{"id":"7f6ac7d977259063","repo":"thanos-io/thanos","slug":"unknown-7f6ac7","errorCode":"Unknown","errorMessage":"send metric metadata response","messagePattern":"send metric metadata response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/metadata/proxy.go","lineNumber":83,"sourceCode":"\t\t_ = g.Wait()\n\t\tclose(respChan)\n\t}()\n\n\tfor resp := range respChan {\n\t\tmetas = append(metas, resp)\n\t}\n\n\tif err := g.Wait(); err != nil {\n\t\tlevel.Error(s.logger).Log(\"err\", err)\n\t\treturn err\n\t}\n\n\tfor _, t := range metas {\n\t\ttracing.DoInSpan(srv.Context(), \"send_metadata_response\", func(_ context.Context) {\n\t\t\terr = srv.Send(metadatapb.NewMetricMetadataResponse(t))\n\t\t})\n\t\tif err != nil {\n\t\t\treturn status.Error(codes.Unknown, errors.Wrap(err, \"send metric metadata response\").Error())\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype metricMetadataStream struct {\n\tclient  metadatapb.MetadataClient\n\trequest *metadatapb.MetricMetadataRequest\n\tchannel chan<- *metadatapb.MetricMetadata\n\tserver  metadatapb.Metadata_MetricMetadataServer\n}\n\nfunc (stream *metricMetadataStream) receive(ctx context.Context) error {\n\tvar (\n\t\terr         error\n\t\tmetadataCli metadatapb.Metadata_MetricMetadataClient\n\t)","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/metadata/proxy.go#L65-L101","documentation":"In the metadata proxy's MetricMetadata handler, srv.Send is invoked per metadata batch inside a span; any send failure is converted to a gRPC status.Error(codes.Unknown, ...) wrapped with this message. It means the server could not push a metadata response onto the client stream.","triggerScenarios":"srv.Send returns an error while streaming metadata batches — e.g. the 'no metadata' guard, or the client canceled/closed the stream mid-flight.","commonSituations":"Client disconnects during a large metadata scan; warnings/nil payloads triggering metadataServer.Send errors; seen in TestProxyDataRace when concurrent sends misbehave.","solutions":["Check the wrapped inner error to see whether it is 'no metadata' vs a canceled stream","Ensure the client keeps the stream open until results are consumed","Upgrade to matching cloud/Vizier versions to avoid empty metadata messages","Avoid concurrent use of the stream server (data race) — serialize Send calls"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := client.MetricMetadata(ctx, req)\nif err != nil {\n    st, ok := status.FromError(err)\n    if ok && st.Code() == codes.Unknown && strings.Contains(st.Message(), \"send metric metadata response\") {\n        // stream broke mid-response; retry or reconnect\n    }\n}","preventionTips":["Do not cancel the client stream before consuming all results","Serialize access to the stream server to avoid data races (see TestProxyDataRace)","Keep gRPC keepalives configured for long metadata scans"],"tags":["grpc","streaming","codes-unknown"],"backgroundTag":"broken-pipe","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"}