{"record":{"id":"925295068de8f251","repo":"golangci/golangci-lint","slug":"s-invalid-configuration-w","errorCode":null,"errorMessage":"%s: invalid configuration: %w","messagePattern":"(.+?): invalid configuration: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/lint/linter/config.go","lineNumber":204,"sourceCode":"\t\t\tencoder.SetIndent(2)\n\n\t\t\tlinters := map[string]any{\n\t\t\t\t\"enable\": []string{d.Replacement},\n\t\t\t}\n\n\t\t\treplacementSettings := mgr(data)\n\n\t\t\tif replacementSettings != nil {\n\t\t\t\tlinters[\"settings\"] = map[string]any{d.Replacement: replacementSettings}\n\t\t\t}\n\n\t\t\tsuggestion := map[string]any{\n\t\t\t\t\"linters\": linters,\n\t\t\t}\n\n\t\t\terr := encoder.Encode(suggestion)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"%s: invalid configuration: %w\", d.Replacement, err)\n\t\t\t}\n\n\t\t\treturn buf.String(), nil\n\t\t}\n\t}\n}\n\nfunc IsGoLowerThanGo122() func(cfg *config.Config) error {\n\treturn isGoLowerThanGo(\"1.22\")\n}\n\nfunc isGoLowerThanGo(v string) func(cfg *config.Config) error {\n\treturn func(cfg *config.Config) error {\n\t\tif cfg == nil || config.IsGoGreaterThanOrEqual(cfg.Run.Go, v) {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"this linter is disabled because the Go version (%s) of your project is lower than Go %s\", cfg.Run.Go, v)","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/lint/linter/config.go#L186-L222","documentation":"In the linter config builder, when a deprecated linter has a Replacement, the tool generates a suggested configuration for the replacement and encodes it. If encoding that suggestion fails, the error is wrapped as \"<replacement>: invalid configuration\". It indicates the generated suggestion for the replacement linter could not be produced.","triggerScenarios":"Using a deprecated linter that declares a Replacement, where building/encoding the replacement's suggested settings via encoder.Encode returns an error (e.g. an unsupported setting value in the suggestion map).","commonSituations":"Migrating off a deprecated linter whose replacement requires settings the current config version cannot represent; corrupted or hand-edited config that the suggestion generator chokes on.","solutions":["Read the wrapped cause after \"invalid configuration\" for the encode failure detail.","Manually replace the deprecated linter with its replacement in .golangci.yml instead of relying on the generated suggestion.","Update golangci-lint to the latest version so replacement suggestion generation matches your config schema.","Validate your config with `golangci-lint config verify` to catch schema problems."],"exampleFix":"// before: relying on deprecated linter with auto-suggestion\nlinters:\n  enable: [interfacer]\n\n// after: migrate manually to the replacement\nlinters:\n  enable: [staticcheck]","handlingStrategy":"validation","validationCode":"// before running\ncmd := exec.Command(\"golangci-lint\", \"config\", \"verify\")\nif out, err := cmd.CombinedOutput(); err != nil {\n    return fmt.Errorf(\"invalid config: %s\", out)\n}","typeGuard":null,"tryCatchPattern":"cfg, err := buildLintersConfig(raw)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid configuration\") {\n        // fall back to manually migrating deprecated linters\n        log.Warnf(\"auto-suggestion failed (%v); migrate manually\", err)\n        return manualMigration(raw)\n    }\n    return err\n}","preventionTips":["Migrate deprecated linters proactively instead of relying on auto-suggestions.","Validate config with `golangci-lint config verify` in CI.","Keep golangci-lint updated to match your config schema version."],"tags":["go","configuration","deprecated-linter"],"backgroundTag":"invalid-linter-config","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}