{"record":{"id":"19d859d4a3491eaa","repo":"golangci/golangci-lint","slug":"failed-to-configure-analyzer-s-w","errorCode":null,"errorMessage":"failed to configure analyzer %s: %w","messagePattern":"failed to configure analyzer (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/goanalysis/linter.go","lineNumber":176,"sourceCode":"\n\treturn nil\n}\n\nfunc (lnt *Linter) configure() error {\n\tanalyzersMap := map[string]*analysis.Analyzer{}\n\tfor _, a := range lnt.analyzers {\n\t\tanalyzersMap[a.Name] = a\n\t}\n\n\tfor analyzerName, analyzerSettings := range lnt.cfg {\n\t\ta := analyzersMap[analyzerName]\n\t\tif a == nil {\n\t\t\treturn fmt.Errorf(\"settings key %q must be valid analyzer name, valid analyzers: %v\",\n\t\t\t\tanalyzerName, lnt.allAnalyzerNames())\n\t\t}\n\n\t\tif err := lnt.configureAnalyzer(a, analyzerSettings); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to configure analyzer %s: %w\", analyzerName, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (lnt *Linter) preRun(lintCtx *linter.Context) error {\n\tif err := analysis.Validate(lnt.analyzers); err != nil {\n\t\treturn fmt.Errorf(\"failed to validate analyzers: %w\", err)\n\t}\n\n\tif err := lnt.configure(); err != nil {\n\t\treturn fmt.Errorf(\"failed to configure analyzers: %w\", err)\n\t}\n\n\tif lnt.contextSetter != nil {\n\t\tlnt.contextSetter(lintCtx)\n\t}","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/goanalysis/linter.go#L158-L194","documentation":"A wrapping error from Linter.configure: when configureAnalyzer fails for a specific analyzer (e.g. invalid setting value as in error 160), this message adds the analyzer name context before propagating. It indicates analyzer-specific configuration failed; the root cause is in the wrapped chain (%w).","triggerScenarios":"Any case where lnt.configureAnalyzer returns an error — invalid analyzer setting key, or a value that flag.Value.Set cannot parse — during preRun before analyzers run.","commonSituations":"Same as its causes: bad value types or unknown setting names under a specific analyzer's section in .golangci.yml; commonly surfaced during CI after a config edit or version bump.","solutions":["Read the full error chain: this message names the analyzer, the wrapped error names the offending setting/value","Fix or remove the offending setting under that analyzer's config section","Validate config with `golangci-lint config verify` if available","Pin/check the golangci-lint version to ensure setting names match the version in use"],"exampleFix":"# before (.golangci.yml)\nsettings:\n  staticcheck:\n    unknown-flag: true\n# after\nsettings:\n  staticcheck:\n    checks: [\"all\"]","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := linter.Run(lintCtx); err != nil {\n    if strings.Contains(err.Error(), \"failed to configure analyzer\") {\n        // extract analyzer name and the wrapped root cause for a clear report\n        return fmt.Errorf(\"config error: %v\", errors.Unwrap(err))\n    }\n    return err\n}","preventionTips":["Read the whole wrapped chain (errors.Unwrap / %+v) to reach the real cause","Test config changes locally before pushing to CI","Keep per-analyzer settings minimal and documented"],"tags":["golangci-lint","configuration","error-wrapping"],"backgroundTag":"analyzer-configuration-failed","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}