{"record":{"id":"a682652533869870","repo":"golangci/golangci-lint","slug":"unsupported-version-of-the-configuration-q-see-h","errorCode":null,"errorMessage":"unsupported version of the configuration: %q See https://golangci-lint.run/docs/product/migration-guide for migration instructions","messagePattern":"unsupported version of the configuration: %q See https://golangci-lint\\.run/docs/product/migration-guide for migration instructions","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/loader.go","lineNumber":155,"sourceCode":"\tif l.fs == nil {\n\t\treturn\n\t}\n\n\tl.appendStringSlice(\"enable\", &l.cfg.Linters.Enable)\n\tl.appendStringSlice(\"disable\", &l.cfg.Linters.Disable)\n\tl.appendStringSlice(\"build-tags\", &l.cfg.Run.BuildTags)\n}\n\nfunc (l *Loader) appendStringSlice(name string, current *[]string) {\n\tif l.fs.Changed(name) {\n\t\tval, _ := l.fs.GetStringSlice(name)\n\t\t*current = append(*current, val...)\n\t}\n}\n\nfunc (l *Loader) checkConfigurationVersion() error {\n\tif l.cfg.GetConfigDir() != \"\" && l.cfg.Version != \"2\" {\n\t\treturn fmt.Errorf(\"unsupported version of the configuration: %q \"+\n\t\t\t\"See https://golangci-lint.run/docs/product/migration-guide for migration instructions\", l.cfg.Version)\n\t}\n\n\treturn nil\n}\n\nfunc (l *Loader) handleGoVersion() {\n\tif l.cfg.Run.Go == \"\" {\n\t\tl.cfg.Run.Go = detectGoVersion(context.Background(), l.log)\n\t}\n\n\tl.cfg.Linters.Settings.Govet.Go = l.cfg.Run.Go\n\n\tl.cfg.Linters.Settings.ParallelTest.Go = l.cfg.Run.Go\n\n\tl.cfg.Linters.Settings.GoFumpt.LangVersion = l.cfg.Run.Go\n\tl.cfg.Formatters.Settings.GoFumpt.LangVersion = l.cfg.Run.Go\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/loader.go#L137-L173","documentation":"checkConfigurationVersion requires config files (when a config dir is present) to declare version: '2'. Any other version string — missing, '1', or a typo — is rejected with a pointer to the migration guide, since v2 changed the config schema significantly.","triggerScenarios":"Running golangci-lint v2 with a config lacking 'version: \"2\"' or with version set to anything else; running v2 against a legacy v1 .golangci.yml.","commonSituations":"Upgrading golangci-lint from v1 to v2 without migrating the config; hand-rolled configs forgetting the version key; version set to '2.0' instead of '2'.","solutions":["Add or set version: \"2\" at the top of the config file after migrating it","Run 'golangci-lint migrate' to convert a v1 config to v2 automatically","Follow https://golangci-lint.run/docs/product/migration-guide for manual migration"],"exampleFix":"# before\nlinters:\n  enable:\n    - revive\n# after\nversion: \"2\"\nlinters:\n  enable:\n    - revive","handlingStrategy":"validation","validationCode":"data, _ := os.ReadFile(cfgPath)\nvar m map[string]any\n_ = yaml.Unmarshal(data, &m)\nif m[\"version\"] != \"2\" {\n\treturn fmt.Errorf(\"config must declare version: \\\"2\\\" (run golangci-lint migrate)\")\n}","typeGuard":null,"tryCatchPattern":"if err := loader.Load(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"unsupported version\") {\n\t\tlog.Fatal(\"run 'golangci-lint migrate' to upgrade config to v2\")\n\t}\n}","preventionTips":["Always declare version: \"2\" in v2-era configs","Run 'golangci-lint migrate' once when upgrading from v1","Use exactly \"2\", not \"2.0\" or \"v2\""],"tags":["golangci-lint","config-version","migration"],"backgroundTag":"unsupported-config-version","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}