{"record":{"id":"47299ea8498f3252","repo":"thanos-io/thanos","slug":"unknown-47299e","errorCode":"Unknown","errorMessage":"send targets response","messagePattern":"send targets response","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/targets/proxy.go","lineNumber":76,"sourceCode":"\n\tgo func() {\n\t\t_ = g.Wait()\n\t\tclose(respChan)\n\t}()\n\n\tfor resp := range respChan {\n\t\t// TODO: Stream it\n\t\ttargets = append(targets, 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 targets {\n\t\tif err := srv.Send(targetspb.NewTargetsResponse(t)); err != nil {\n\t\t\treturn status.Error(codes.Unknown, errors.Wrap(err, \"send targets response\").Error())\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype targetsStream struct {\n\tclient  targetspb.TargetsClient\n\trequest *targetspb.TargetsRequest\n\tchannel chan<- *targetspb.TargetDiscovery\n\tserver  targetspb.Targets_TargetsServer\n}\n\nfunc (stream *targetsStream) receive(ctx context.Context) error {\n\ttargets, err := stream.client.Targets(ctx, stream.request)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"fetching targets from targets client %v\", stream.client)\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/targets/proxy.go#L58-L94","documentation":"The targets proxy's Targets gRPC handler streams each fetched target to the client via srv.Send. If any send fails, it wraps the error as 'send targets response' with a gRPC Unknown status. The failure is on the server->client stream leg, e.g. the client disconnected.","triggerScenarios":"Calling Targets and having srv.Send return a non-nil error — typically the client canceled the context/closed the connection mid-stream, or the transport broke while streaming targets.","commonSituations":"Query cancellations in Grafana or the querier tearing down gRPC streams, network partitions between querier and targets proxy, deadlines exceeded during large target sets.","solutions":["Check whether the client canceled (context.Canceled) — that is benign and can be ignored/logged at debug level","Verify network connectivity and keepalive settings between client and proxy","Reduce response size (fewer targets, pagination) to avoid long-lived streams","Update client/server grpc-go versions to fix stream teardown bugs"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := srv.Send(resp); err != nil { if status.Code(err) == codes.Canceled || errors.Is(err, context.Canceled) { return nil } return status.Error(codes.Unknown, errors.Wrap(err, \"send targets response\").Error()) }","preventionTips":["Treat client cancellation as normal, not an alert-worthy failure","Tune gRPC keepalive to survive idle streams","Limit target set size per stream"],"tags":["grpc","streaming","targets","proxy"],"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"}