{"record":{"id":"2f247893ba309611","repo":"thanos-io/thanos","slug":"sending-rules-error-to-server-v","errorCode":null,"errorMessage":"sending rules error to server %v","messagePattern":"sending rules error to server (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rules/proxy.go","lineNumber":136,"sourceCode":"\n\tfor {\n\t\trule, err := rules.Recv()\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\t// An error happened in Recv(), hence the underlying stream is aborted\n\t\t\t// as per https://github.com/grpc/grpc-go/blob/7f2581f910fc21497091c4109b56d310276fc943/stream.go#L117-L125.\n\t\t\t// We must not continue receiving additional data from it and must return.\n\t\t\terr = errors.Wrapf(err, \"receiving rules from rules 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(rulespb.NewWarningRulesResponse(err)); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"sending rules error to server %v\", stream.server)\n\t\t\t}\n\n\t\t\t// Return no error if response strategy is warning.\n\t\t\treturn nil\n\t\t}\n\n\t\tif w := rule.GetWarning(); w != \"\" {\n\t\t\tif err := stream.server.Send(rulespb.NewWarningRulesResponse(errors.New(w))); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"sending rules warning to server %v\", stream.server)\n\t\t\t}\n\t\t\t// Client stream is not aborted, it is ok to receive additional data.\n\t\t\tcontinue\n\t\t}\n\n\t\tselect {\n\t\tcase stream.channel <- rule.GetGroup():\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/rules/proxy.go#L118-L154","documentation":"Raised in rulesStream.receive after an upstream Recv error when the strategy is not ABORT: the code forwards the failure as a WarningRulesResponse via stream.server.Send, and that send to the client itself fails. This masks the original receive error with a second transport failure.","triggerScenarios":"Thrown at pkg/rules/proxy.go:136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check why the downstream gRPC server stream is broken (client gone, context canceled)","Log both the original upstream error and the send failure for diagnosis","Consider buffering/limiting warnings if slow clients cause send errors"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}