{"record":{"id":"ab14c89dcebaa68a","repo":"thanos-io/thanos","slug":"receiving-targets-from-targets-client-v","errorCode":null,"errorMessage":"receiving targets from targets client %v","messagePattern":"receiving targets from targets client (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/targets/proxy.go","lineNumber":113,"sourceCode":"\t\tif stream.request.PartialResponseStrategy == storepb.PartialResponseStrategy_ABORT {\n\t\t\treturn err\n\t\t}\n\n\t\tif serr := stream.server.Send(targetspb.NewWarningTargetsResponse(err)); serr != nil {\n\t\t\treturn serr\n\t\t}\n\t\t// Not an error if response strategy is warning.\n\t\treturn nil\n\t}\n\n\tfor {\n\t\ttarget, err := targets.Recv()\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\terr = errors.Wrapf(err, \"receiving targets from targets client %v\", stream.client)\n\n\t\t\tif stream.request.PartialResponseStrategy == storepb.PartialResponseStrategy_ABORT {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := stream.server.Send(targetspb.NewWarningTargetsResponse(err)); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"sending targets error to server %v\", stream.server)\n\t\t\t}\n\t\t\t// Not an error if response strategy is warning.\n\t\t\treturn nil\n\t\t}\n\n\t\tif w := target.GetWarning(); w != \"\" {\n\t\t\tif err := stream.server.Send(targetspb.NewWarningTargetsResponse(errors.New(w))); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"sending targets warning to server %v\", stream.server)\n\t\t\t}\n\t\t\tcontinue\n\t\t}","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/targets/proxy.go#L95-L131","documentation":"This error wraps a failure from the gRPC Recv() call while a Thanos proxy StreamsTargets from an upstream targets client (e.g. a sidecar or store). The underlying error may be a transport failure, context cancellation, or the upstream server closing with an error. Depending on PartialResponseStrategy it either aborts the stream or is downgraded to a warning response.","triggerScenarios":"TargetsServer.receive() receives a non-EOF error from targets.Recv() on the gRPC stream, e.g. upstream unreachable, stream reset, or context deadline exceeded.","commonSituations":"The queried TargetsAPI endpoint (sidecar/store gateway) is down or restarting; network interruption between query and targets source; gRPC context canceled due to query timeout; TLS or auth misconfiguration to the upstream.","solutions":["Check the wrapped cause error to identify the upstream failure (connectivity, deadline, cancellation).","Verify the upstream TargetsAPI (sidecar/store) address in the store/sidecar config is reachable: curl/tonic the gRPC endpoint and check --grpc-address flags.","Check query timeout settings (--query.timeout) and increase if large target lists cause deadline exceeded.","If failures should not abort the whole response, use PartialResponseStrategy_WARNING so the error is sent as a warning instead.","Inspect gRPC logs and TLS certificates if the stream fails to authenticate to the upstream."],"exampleFix":"// before: errors.Wrapf(err, \"receiving targets from targets client %v\", stream.client)\n// after (diagnose cause first):\nif errors.Is(errors.Cause(err), context.DeadlineExceeded) {\n    log.Warnf(\"targets stream timeout, increasing query timeout may help: %v\", err)\n}\nreturn err","handlingStrategy":"try-catch","validationCode":"// Go: check reachability before querying targets\nif err := probeGRPC(ctx, sidecarAddr); err != nil { return fmt.Errorf(\"targets upstream %s unreachable: %w\", sidecarAddr, err) }","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if errors.Is(errors.Cause(err), context.DeadlineExceeded) || errors.Is(errors.Cause(err), context.Canceled) {\n        return nil, fmt.Errorf(\"targets stream canceled: %w\", err)\n    }\n    return nil, err\n}","preventionTips":["Health-check the TargetsAPI endpoint before fan-out","Use PartialResponseStrategy_WARNING for tolerant queries","Keep gRPC connections warm and set sane timeouts"],"tags":["grpc","streaming","network","thanos-targets"],"backgroundTag":"network-request-failed","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"}