golangci/golangci-lint · error
unsupported sort-order name %q
Error message
unsupported sort-order name %q
What it means
This error is thrown during output config validation when a sort-order name is not one of the three supported keys: 'linter', 'file', 'severity'. The validator uses slices.Contains against that allowlist and rejects anything else. It indicates a typo or an unsupported key in output.sort-order.
Source
Thrown at pkg/config/output.go:45
return err
}
}
return nil
}
func (o *Output) validateSortOrder() error {
validOrders := []string{"linter", "file", "severity"}
all := strings.Join(o.SortOrder, " ")
for _, order := range o.SortOrder {
if strings.Count(all, order) > 1 {
return fmt.Errorf("the sort-order name %q is repeated several times", order)
}
if !slices.Contains(validOrders, order) {
return fmt.Errorf("unsupported sort-order name %q", order)
}
}
return nil
}
func (o *Output) validatePathMode() error {
switch o.PathMode {
case "", fsutils.OutputPathModeAbsolute:
// Valid
default:
return fmt.Errorf("unsupported output path mode %q", o.PathMode)
}
return nil
}
View on GitHub (pinned to ed7a235d2d)
Solutions
- Correct the key to one of: linter, file, severity
- Check `golangci-lint help` or docs for the exact accepted sort-order names in your version
Example fix
// before
output:
sort-order:
- linters
- severity
// after
output:
sort-order:
- linter
- severity Defensive patterns
Strategy: validation
Validate before calling
validOrders := []string{"linter", "file", "severity"}
for _, o := range cfg.Output.SortOrder {
if !slices.Contains(validOrders, o) {
return fmt.Errorf("sort-order %q not in %v", o, validOrders)
}
} Prevention
- Copy sort-order names exactly from the golangci-lint docs for your version
- Run `golangci-lint config verify` in CI to catch typos early
- Prefer generating config from a linter schema or editor YAML schema
When it happens
Trigger: Putting a misspelled or invented key in output.sort-order (e.g. ["linters", "severity"], ["path", "file"]) then running golangci-lint or calling Output.Validate().
Common situations: Typos like 'linters' instead of 'linter' or 'severities'; copying sort keys from other tools; upgrading golangci-lint and a previously-tolerated key is no longer allowed.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
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
- enable-all and disable-all options must not be combined
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/76a1932705d53501.
Report an issue: GitHub.