{"record":{"id":"124628e9b46ddcaf","repo":"golangci/golangci-lint","slug":"can-t-filter-issue-v-w","errorCode":null,"errorMessage":"can't filter issue %#v: %w","messagePattern":"can't filter issue %#v: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/result/processors/issues.go","lineNumber":48,"sourceCode":"\t\t\tretIssues = append(retIssues, issue)\n\t\t}\n\t}\n\n\treturn retIssues\n}\n\nfunc filterIssuesErr(issues []*result.Issue, filter func(issue *result.Issue) (bool, error)) ([]*result.Issue, error) {\n\tretIssues := make([]*result.Issue, 0, len(issues))\n\tfor _, issue := range issues {\n\t\tif issue.FromLinter == typeCheckName {\n\t\t\t// don't hide typechecking errors in generated files: users expect to see why the project isn't compiling\n\t\t\tretIssues = append(retIssues, issue)\n\t\t\tcontinue\n\t\t}\n\n\t\tok, err := filter(issue)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"can't filter issue %#v: %w\", issue, err)\n\t\t}\n\n\t\tif ok {\n\t\t\tretIssues = append(retIssues, issue)\n\t\t}\n\t}\n\n\treturn retIssues, nil\n}\n\nfunc transformIssues(issues []*result.Issue, transform func(issue *result.Issue) *result.Issue) []*result.Issue {\n\tretIssues := make([]*result.Issue, 0, len(issues))\n\tfor _, issue := range issues {\n\t\tnewIssue := transform(issue)\n\t\tif newIssue != nil {\n\t\t\tretIssues = append(retIssues, newIssue)\n\t\t}\n\t}","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/result/processors/issues.go#L30-L66","documentation":"A per-issue filter callback (used by processors such as exclusion rules) returned an error while evaluating an issue. The processor stops and wraps the filter's error together with the offending issue for diagnosis. This is an internal-invariant error: filters are expected to evaluate without error.","triggerScenarios":"A configured exclusion/preset processor (e.g. exclusion-rules with source patterns) whose regex filter fails to compile or match (invalid regexp) when applied to an issue, causing filter(issue) to return err.","commonSituations":"Hand-edited .golangci.yml exclude-rules with malformed regex in `text:` or `source:`; plugin-provided custom filters panicking/erroring; golangci-lint version changes altering filter expectations.","solutions":["Read the wrapped inner error; it usually points to an invalid regex in your exclusion config","Validate every regex in exclude-rules (text/source/path) with a regex tester or linter","Update golangci-lint or the plugin providing the custom filter","Temporarily remove exclusion rules one by one to identify the offending rule"],"exampleFix":"# before (.golangci.yml)\nexclude-rules:\n  - path: \"pkg/([unclosed\"\n# after\nexclude-rules:\n  - path: \"^pkg/internal/\"","handlingStrategy":"try-catch","validationCode":"// pre-validate exclusion regexes before running\nfor _, rule := range cfg.ExcludeRules {\n    if _, err := regexp.Compile(rule.Text); err != nil {\n        return fmt.Errorf(\"invalid exclude-rule regex %q: %w\", rule.Text, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"issues, err := processor.Process(issues)\nvar wrapped *fmt.WrapError\nif err != nil {\n    if strings.Contains(err.Error(), \"can't filter issue\") {\n        log.Printf(\"filter failed: %v — check exclude-rules regexes\", err)\n    }\n    return err\n}","preventionTips":["Test every exclusion regex against sample issue text before committing config","Run `golangci-lint config verify` when available","Avoid hand-editing regex paths; use anchored, simple patterns","Upgrade golangci-lint/plugins when filter internals change"],"tags":["golangci-lint","filter","regex","configuration"],"backgroundTag":"invalid-regex-filter","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}