{"record":{"id":"ee8abcc7204d8274","repo":"thanos-io/thanos","slug":"strategy-s-update-rules","errorCode":null,"errorMessage":"strategy %s, update rules","messagePattern":"strategy (.+?), update rules","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rules/manager.go","lineNumber":394,"sourceCode":"\t\t\t\terrs.Add(errors.Wrapf(err, \"write file %v\", newFn))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfilesByStrategy[s] = append(filesByStrategy[s], newFn)\n\t\t\truleFiles[newFn] = fn\n\t\t}\n\t}\n\n\tm.mtx.Lock()\n\tfor s, fs := range filesByStrategy {\n\t\tmgr, ok := m.mgrs[s]\n\t\tif !ok {\n\t\t\terrs.Add(errors.Errorf(\"no manager found for %v\", s))\n\t\t\tcontinue\n\t\t}\n\t\t// We add external labels in `pkg/alert.Queue`.\n\t\tif err := mgr.Update(evalInterval, fs, m.extLset, m.externalURL, nil); err != nil {\n\t\t\t// TODO(bwplotka): Prometheus logs all error details. Fix it upstream to have consistent error handling.\n\t\t\terrs.Add(errors.Wrapf(err, \"strategy %s, update rules\", s))\n\t\t\tcontinue\n\t\t}\n\t}\n\tm.ruleFiles = ruleFiles\n\tm.mtx.Unlock()\n\n\treturn errs.Err()\n}\n\n// Rules returns specified rules from manager. This is used by gRPC and locally for HTTP and UI purposes.\nfunc (m *Manager) Rules(r *rulespb.RulesRequest, s rulespb.Rules_RulesServer) (err error) {\n\tgroups := m.protoRuleGroups()\n\n\tpgs := make([]*rulespb.RuleGroup, 0, len(groups))\n\tfor _, g := range groups {\n\t\t// UTC needed due to https://github.com/gogo/protobuf/issues/519.\n\t\tg.LastEvaluation = g.LastEvaluation.UTC()\n\t\tif r.Type == rulespb.RulesRequest_ALL {","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/rules/manager.go#L376-L412","documentation":"Raised in Manager.Update when the per-strategy Prometheus rules.Manager Update call fails — i.e., the underlying rule groups for that strategy failed Prometheus parsing, validation, or loading (bad expressions, duplicate group names, invalid intervals). The error wraps the upstream manager's error with 'strategy %s, update rules'.","triggerScenarios":"Thrown at pkg/rules/manager.go:394 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the rule file syntax/semantics named in the wrapped error (invalid PromQL, duplicate groups, bad durations)","Validate rule files with promtool before deploying","Compare with the previous working rule files to find the regression"],"exampleFix":null,"handlingStrategy":"validation","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"}