golangci/golangci-lint · error
unsupported configuration format
Error message
unsupported configuration format
What it means
`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.
Source
Thrown at pkg/commands/config_verify.go:73
var m any
switch strings.ToLower(filepath.Ext(targetFile)) {
case ".yaml", ".yml", ".json":
m, err = decodeYamlFile(targetFile)
if err != nil {
return err
}
case ".toml":
m, err = decodeTomlFile(targetFile)
if err != nil {
return err
}
default:
// unsupported
return errors.New("unsupported configuration format")
}
return schema.Validate(m)
}
func printValidationDetail(cmd *cobra.Command, detail *jsonschema.OutputUnit) {
if detail.Error != nil {
data, _ := json.Marshal(detail.Error)
details, _ := strconv.Unquote(string(data))
cmd.PrintErrf("jsonschema: %q does not validate with %q: %s\n",
strings.ReplaceAll(strings.TrimPrefix(detail.InstanceLocation, "/"), "/", "."), detail.KeywordLocation, details)
}
for _, d := range detail.Errors {
printValidationDetail(cmd, &d)
}
}View on GitHub (pinned to ed7a235d2d)
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)
Example fix
# before mv .golangci.conf .golangci.yml # .conf is unsupported # after mv .golangci.conf .golangci.yml
Defensive patterns
Strategy: validation
Validate before calling
func hasSupportedConfigExt(path string) bool {
switch strings.ToLower(filepath.Ext(path)) {
case ".yaml", ".yml", ".json", ".toml":
return true
}
return false
}
// guard: if !hasSupportedConfigExt(cfgPath) { ... } Type guard
func isSupportedConfigFile(path string) bool {
ext := strings.ToLower(filepath.Ext(path))
return ext == ".yaml" || ext == ".yml" || ext == ".json" || ext == ".toml"
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- the configuration contains invalid elements
- the configuration contains invalid elements
- can't set severity rule option: no default severity defined
- severity should be set
- analyzer doesn't have settings
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/2ecafc5b652df623.
Report an issue: GitHub.