{"record":{"id":"e083eb9d81417579","repo":"golangci/golangci-lint","slug":"failed-to-get-doc-s-of-file-s-w","errorCode":null,"errorMessage":"failed to get doc (%s) of file %s: %w","messagePattern":"failed to get doc \\((.+?)\\) of file (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/result/processors/exclusion_generated_file_filter.go","lineNumber":70,"sourceCode":"\nfunc (p *GeneratedFileFilter) shouldPassIssue(issue *result.Issue) (bool, error) {\n\tif filepath.Base(issue.FilePath()) == \"go.mod\" {\n\t\treturn true, nil\n\t}\n\n\t// The file is already known.\n\tfs := p.fileSummaryCache[issue.FilePath()]\n\tif fs != nil {\n\t\treturn !fs.generated, nil\n\t}\n\n\tfs = &fileSummary{}\n\tp.fileSummaryCache[issue.FilePath()] = fs\n\n\tvar err error\n\tfs.generated, err = p.matcher.IsGeneratedFile(issue.FilePath(), nil)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get doc (%s) of file %s: %w\", p.mode, issue.FilePath(), err)\n\t}\n\n\tp.debugf(\"file %q is generated: %t\", issue.FilePath(), fs.generated)\n\n\t// don't report issues for autogenerated files\n\treturn !fs.generated, nil\n}\n","sourceCodeStart":52,"sourceCodeEnd":78,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/result/processors/exclusion_generated_file_filter.go#L52-L78","documentation":"While deciding whether to pass an issue, the generated-file exclusion processor tries to detect if the file is autogenerated by reading its doc comment. The matcher returned an error (e.g. the file could not be parsed or read), so shouldPassIssue aborts with this error naming the mode and file instead of silently filtering or passing the issue.","triggerScenarios":"shouldPassIssue is invoked for an issue whose file fails IsGeneratedFile — the file is unreadable, deleted between scan and filtering, or contains invalid Go syntax so the parser fails.","commonSituations":"Stale file references after files were removed mid-run; generated files with syntax errors checked in; permissions problems on source files; excluding files with non-Go extensions matched by the linter.","solutions":["Fix the syntax error in the reported file so it parses as Go","Restore/verify the file exists and is readable at the reported path","Re-run the lint to clear stale results if the file was deleted concurrently","Exclude the problematic file from linting via run.skip-files if it is not valid Go"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Go: ensure the file parses before filtering relies on generated detection\nfset := token.NewFileSet()\nif _, err := parser.ParseFile(fset, path, nil, parser.PackageClauseOnly); err != nil {\n    log.Printf(\"skipping unparseable file %s: %v\", path, err)\n}","typeGuard":null,"tryCatchPattern":"pass, err := filter.ShouldPassIssue(issue)\nif err != nil {\n    log.Printf(\"generated-file detection failed, keeping issue: %v\", err)\n    pass = true\n}","preventionTips":["Keep generated files syntactically valid and regenerate them in CI","Exclude non-Go files from linting with skip-files","Verify file permissions on source trees in CI containers"],"tags":["parser","generated-files","golangci-lint"],"backgroundTag":"go-parse-error","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}