{"record":{"id":"c6c9532989a1cb1d","repo":"thanos-io/thanos","slug":"res-getwarning-propagated-warning","errorCode":null,"errorMessage":"res.GetWarning() (propagated warning)","messagePattern":"res\\.GetWarning\\(\\) \\(propagated warning\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/rules/rules.go","lineNumber":280,"sourceCode":"\t}\n\treturn groups[:i+1]\n}\n\ntype rulesServer struct {\n\t// This field just exist to pseudo-implement the unused methods of the interface.\n\trulespb.Rules_RulesServer\n\tctx context.Context\n\n\twarnings annotations.Annotations\n\tgroups   []*rulespb.RuleGroup\n\tmu       sync.Mutex\n}\n\nfunc (srv *rulesServer) Send(res *rulespb.RulesResponse) error {\n\tif res.GetWarning() != \"\" {\n\t\tsrv.mu.Lock()\n\t\tdefer srv.mu.Unlock()\n\t\tsrv.warnings.Add(errors.New(res.GetWarning()))\n\t\treturn nil\n\t}\n\n\tif res.GetGroup() == nil {\n\t\treturn errors.New(\"no group\")\n\t}\n\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\tsrv.groups = append(srv.groups, res.GetGroup())\n\treturn nil\n}\n\nfunc (srv *rulesServer) Context() context.Context {\n\treturn srv.ctx\n}\n","sourceCodeStart":262,"sourceCodeEnd":297,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/rules/rules.go#L262-L297","documentation":"This is the warning-propagation path of rulesServer.Send: when a RulesResponse carries a Warning, the server collects it into srv.warnings and returns nil instead of treating it as a group. The message 'res.GetWarning() (propagated warning)' labels this code path; no error is thrown here by design.","triggerScenarios":"An upstream ruler streams a rulespb.RulesResponse with the Warning field set (e.g. partial results, rule limit exceeded) while the client consumes the Rules stream.","commonSituations":"Large rule sets where upstream truncates results; deprecation or limit warnings surfaced by the ruler; callers ignoring resp warnings and seeing fewer rules than expected.","solutions":["Check the warnings returned alongside groups and log/act on them","If rules appear missing, the upstream probably emitted a warning explaining the truncation","Address the upstream-side condition (e.g. reduce rule count or fix ruler limits)"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isWarningResponse(res *rulespb.RulesResponse) bool {\n    return res.GetWarning() != \"\"\n}","tryCatchPattern":null,"preventionTips":["Always inspect and log warnings returned with rule groups","Don't assume the group count equals the upstream rule count when warnings are present"],"tags":["grpc","warnings","streaming"],"backgroundTag":"unexpected-response-shape","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"}