{"record":{"id":"2ecafc5b652df623","repo":"golangci/golangci-lint","slug":"unsupported-configuration-format","errorCode":null,"errorMessage":"unsupported configuration format","messagePattern":"unsupported configuration format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/config_verify.go","lineNumber":73,"sourceCode":"\n\tvar m any\n\n\tswitch strings.ToLower(filepath.Ext(targetFile)) {\n\tcase \".yaml\", \".yml\", \".json\":\n\t\tm, err = decodeYamlFile(targetFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \".toml\":\n\t\tm, err = decodeTomlFile(targetFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\tdefault:\n\t\t// unsupported\n\t\treturn errors.New(\"unsupported configuration format\")\n\t}\n\n\treturn schema.Validate(m)\n}\n\nfunc printValidationDetail(cmd *cobra.Command, detail *jsonschema.OutputUnit) {\n\tif detail.Error != nil {\n\t\tdata, _ := json.Marshal(detail.Error)\n\t\tdetails, _ := strconv.Unquote(string(data))\n\n\t\tcmd.PrintErrf(\"jsonschema: %q does not validate with %q: %s\\n\",\n\t\t\tstrings.ReplaceAll(strings.TrimPrefix(detail.InstanceLocation, \"/\"), \"/\", \".\"), detail.KeywordLocation, details)\n\t}\n\n\tfor _, d := range detail.Errors {\n\t\tprintValidationDetail(cmd, &d)\n\t}\n}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/commands/config_verify.go#L55-L91","documentation":"`validateConfiguration` (pkg/commands/config_verify.go:73) only knows how to decode `.yaml`, `.yml`, `.json` and `.toml` configuration files; anything else falls into the `default` branch and returns this error. It means the extension of the target file passed to config validation is not a supported format, so no decoder exists for it.","triggerScenarios":"Calling `golangci-lint config verify` or the internal `validateConfiguration` with a target file whose extension is not .yaml/.yml/.json/.toml — e.g. pointing at a .ini, .conf, extension-less file, or a `.golangci.json5`; also programmatic calls to validateConfiguration with a wrong path.","commonSituations":"Renaming the config file and losing/altering its extension; pointing verification at the wrong file (e.g. a Makefile or README); tools generating config with an exotic extension; case variants are handled (`filepath.Ext` result is lowercased), so only truly unknown extensions trigger it.","solutions":["Rename the configuration file to use a supported extension: .golangci.yml, .golangci.yaml, .golangci.json, or .golangci.toml","Check the path/argument passed to the verify command — it may point at the wrong file","Convert the configuration content into one of the supported formats (YAML is the conventional choice)"],"exampleFix":"# before\nmv .golangci.conf .golangci.yml   # .conf is unsupported\n# after\nmv .golangci.conf .golangci.yml","handlingStrategy":"validation","validationCode":"func hasSupportedConfigExt(path string) bool {\n    switch strings.ToLower(filepath.Ext(path)) {\n    case \".yaml\", \".yml\", \".json\", \".toml\":\n        return true\n    }\n    return false\n}\n// guard: if !hasSupportedConfigExt(cfgPath) { ... }","typeGuard":"func isSupportedConfigFile(path string) bool {\n\text := strings.ToLower(filepath.Ext(path))\n\treturn ext == \".yaml\" || ext == \".yml\" || ext == \".json\" || ext == \".toml\"\n}","tryCatchPattern":null,"preventionTips":["Keep the standard config names (.golangci.yml/.yaml/.json/.toml) with proper extensions","Never rename the config to an extension-less or exotic-extension name","Check `ls` for the exact file name if the linter seems to be validating the wrong file"],"tags":["golangci-lint","config","file-format"],"backgroundTag":"unsupported-file-format","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}