{"record":{"id":"d3e07c5617be4ce5","repo":"golangci/golangci-lint","slug":"can-t-run-linter-s","errorCode":null,"errorMessage":"can't run linter %s","messagePattern":"can't run linter (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/lint/runner.go","lineNumber":144,"sourceCode":"\t\tLog:     log,\n\t}, nil\n}\n\nfunc (r *Runner) Run(ctx context.Context, linters []*linter.Config) ([]*result.Issue, error) {\n\tsw := timeutils.NewStopwatch(\"linters\", r.Log)\n\tdefer sw.Print()\n\n\tvar (\n\t\tlintErrors error\n\t\tissues     []*result.Issue\n\t)\n\n\tfor _, lc := range linters {\n\t\tlinterIssues, err := timeutils.TrackStage(sw, lc.Name(), func() ([]*result.Issue, error) {\n\t\t\treturn r.runLinterSafe(ctx, r.lintCtx, lc)\n\t\t})\n\t\tif err != nil {\n\t\t\tlintErrors = errors.Join(lintErrors, fmt.Errorf(\"can't run linter %s\", lc.Linter.Name()), err)\n\t\t\tr.Log.Warnf(\"Can't run linter %s: %v\", lc.Linter.Name(), err)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tissues = append(issues, linterIssues...)\n\t}\n\n\treturn r.processLintResults(issues), lintErrors\n}\n\nfunc (r *Runner) runLinterSafe(ctx context.Context, lintCtx *linter.Context,\n\tlc *linter.Config,\n) (ret []*result.Issue, err error) {\n\tdefer func() {\n\t\tif panicData := recover(); panicData != nil {\n\t\t\tif pe, ok := panicData.(*errorutil.PanicError); ok {\n\t\t\t\terr = fmt.Errorf(\"%s: %w\", lc.Name(), pe)","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/lint/runner.go#L126-L162","documentation":"Runner.Run executes each enabled linter via runLinterSafe inside a timed stage tracker. If a linter returns an error (not a panic), Run joins it into a joined error with the message \"can't run linter <name>\" and continues with the remaining linters. Linting overall continues; the failure is reported at the end.","triggerScenarios":"Any non-panic error returned from a linter's analysis pass in runLinterSafe: analyzer reporting fatal diagnostics, linter failing to parse invalid Go syntax, running out of memory/timeout for huge packages, or a linter's internal dependency failing on the given codebase.","commonSituations":"Linter choking on generated or malformed code; timeout (`run.timeout`) hitting on large repos; a newly updated linter version incompatible with the codebase; linter requiring CGO while CGO_ENABLED=0.","solutions":["Check the accompanying Warnf log \"Can't run linter <name>: <err>\" for the underlying cause","Run golangci-lint with `-v` to see per-linter stage output and isolate the failing linter","Run the failing linter alone (`golangci-lint run --enable-only <name>`) to reproduce and fix its specific issue","Increase `run.timeout`, or exclude problematic files/dirs via `linters.exclusions.rules` if a specific file triggers the failure"],"exampleFix":"// before (.golangci.yml)\nrun:\n  timeout: 1m   # large repo exceeds this\n// after\nrun:\n  timeout: 10m","handlingStrategy":"try-catch","validationCode":"// Isolate the failing linter before a full run:\n// golangci-lint run --enable-only <name> ./...\n// go vet ./...  # many runtime linter failures mirror vet/parse errors","typeGuard":null,"tryCatchPattern":"lintErrors, err := runLinterSafe(ctx, lintCtx, lc)\nif err != nil {\n    var joined interface{ Unwrap() []error }\n    if errors.As(err, &joined) {\n        for _, e := range errors.Unwrap(err).([]error) {\n            log.Warnf(\"linter failed: %v\", e) // handle per-linter cause\n        }\n    }\n    continue // Run() already continues to next linter\n}","preventionTips":["Set a realistic `run.timeout` for your repo size","Exclude generated/vendored files via `linters.exclusions.paths` to avoid pathological inputs","Upgrade golangci-lint regularly so bundled linters match your code's Go version","Run linters individually in CI when bisecting a failure"],"tags":["golangci-lint","linter-runtime","error-join"],"backgroundTag":"linter-run-failed","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}