{"record":{"id":"46b6f42644084914","repo":"thanos-io/thanos","slug":"retrieving-rule-files-failed-ignoring-file-patte","errorCode":null,"errorMessage":"retrieving rule files failed. Ignoring file. pattern %s","messagePattern":"retrieving rule files failed\\. Ignoring file\\. pattern (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/rule.go","lineNumber":1092,"sourceCode":"\t})\n}\n\nfunc reloadRules(logger log.Logger,\n\truleFiles []string,\n\truleMgr *thanosrules.Manager,\n\tevalInterval time.Duration,\n\tmetrics *RuleMetrics) error {\n\tlevel.Debug(logger).Log(\"msg\", \"configured rule files\", \"files\", strings.Join(ruleFiles, \",\"))\n\tvar (\n\t\terrs      errutil.MultiError\n\t\tfiles     []string\n\t\tseenFiles = make(map[string]struct{})\n\t)\n\tfor _, pat := range ruleFiles {\n\t\tfs, err := filepath.Glob(pat)\n\t\tif err != nil {\n\t\t\t// The only error can be a bad pattern.\n\t\t\terrs.Add(errors.Wrapf(err, \"retrieving rule files failed. Ignoring file. pattern %s\", pat))\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, fp := range fs {\n\t\t\tif _, ok := seenFiles[fp]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfiles = append(files, fp)\n\t\t\tseenFiles[fp] = struct{}{}\n\t\t}\n\t}\n\n\tlevel.Info(logger).Log(\"msg\", \"reload rule files\", \"numFiles\", len(files))\n\n\tif err := ruleMgr.Update(evalInterval, files); err != nil {\n\t\tmetrics.configSuccess.Set(0)\n\t\terrs.Add(errors.Wrap(err, \"reloading rules failed\"))\n\t\treturn errs.Err()","sourceCodeStart":1074,"sourceCodeEnd":1110,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/rule.go#L1074-L1110","documentation":"reloadRules expands each configured rule-file pattern with filepath.Glob. The only possible error is a syntactically bad pattern (e.g. unmatched '['); when that happens the pattern is skipped and a wrapped error \"retrieving rule files failed. Ignoring file. pattern %s\" is added to the error group, so the reload continues with remaining patterns but ultimately fails.","triggerScenarios":"Passing --rule-file with a malformed glob such as '/etc/rules/[abc' (unclosed bracket) or an invalid character class; ErrBadPattern from filepath.Glob.","commonSituations":"Shell quoting stripping or mangling brackets in the flag; templating tool emitting a partially-expanded pattern; hand-edited config with a typo in a glob.","solutions":["Fix the offending --rule-file glob pattern (close brackets, escape metacharacters).","Quote the pattern in the shell so it isn't expanded or mangled before reaching Thanos.","Test the pattern with a quick Go/Python glob or ls to confirm it matches the intended files.","Check logs for the exact pattern reported in the message and correct it in the deployment manifest."],"exampleFix":"// before\n--rule-file=/etc/thanos/rules/[abc     # unclosed bracket\n// after\n--rule-file=/etc/thanos/rules/*.yaml","handlingStrategy":"validation","validationCode":"// validate patterns before handing them to thanos\nfor pat in \"$@\"; do python3 -c \"import glob,sys; glob.glob(sys.argv[1])\" \"$pat\" || echo \"bad pattern: $pat\"; done","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer simple *.yaml globs over hand-written character classes","Quote globs in shell to prevent mangling","Smoke-test patterns with ls before deploying"],"tags":["config","glob","rules","validation"],"backgroundTag":"invalid-regex-pattern","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"}