golangci/golangci-lint · error
unsupported sort-order name %q
Error message
unsupported sort-order name %q
What it means
The sort-results processor builds its comparator chain from the configured output.sort-order names; each name must exist in the processor's comparator map. An unknown name aborts processing. This is a configuration validation error.
Source
Thrown at pkg/result/processors/sort_results.go:67
},
cfg: cfg,
}
}
func (SortResults) Name() string { return "sort_results" }
// Process is performing sorting of the result issues.
func (p SortResults) Process(issues []*result.Issue) ([]*result.Issue, error) {
if len(p.cfg.SortOrder) == 0 {
p.cfg.SortOrder = []string{orderNameLinter, orderNameFile}
}
var cmps []issueComparator
for _, name := range p.cfg.SortOrder {
c, ok := p.cmps[name]
if !ok {
return nil, fmt.Errorf("unsupported sort-order name %q", name)
}
cmps = append(cmps, c...)
}
comp := mergeComparators(cmps...)
slices.SortFunc(issues, func(a, b *result.Issue) int {
return comp(a, b)
})
return issues, nil
}
func (SortResults) Finish() {}
func byFileName(a, b *result.Issue) int {
return strings.Compare(a.FilePath(), b.FilePath())View on GitHub (pinned to ed7a235d2d)
Solutions
- Use only supported sort-order values (e.g. file, linter, severity) in output.sort-order
- Check `golangci-lint help` or docs for your version's supported sort-order names
- Fix typos/quotes in .golangci.yml; validate with `golangci-lint config verify` if available
- Pin documentation examples to your installed golangci-lint version
Example fix
# before (.golangci.yml) output: sort-order: [fiel, severity] // after output: sort-order: [file, linter, severity]
Defensive patterns
Strategy: validation
Validate before calling
supported := map[string]bool{"file": true, "linter": true, "severity": true}
for _, name := range cfg.Output.SortOrder {
if !supported[name] {
return fmt.Errorf("unsupported sort-order %q", name)
}
} Prevention
- Use only documented sort-order names for your golangci-lint version
- Run `golangci-lint config verify` after editing config
- Re-check sort-order after upgrading golangci-lint (options change across versions)
- Keep config examples from version-matched docs only
When it happens
Trigger: Setting output.sort-order in .golangci.yml to a name not among the supported comparators (e.g. a typo like "fiel" instead of "file", or a name removed in a newer golangci-lint version).
Common situations: Copy-pasted config from blog posts with outdated sort-order values; upgrading golangci-lint where sort-order options were renamed or removed (sort-results boolean replaced by sort-order list); YAML indentation mistakes merging wrong values.
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
- can't combine option --config and --no-config
- can't get enabled formatters: %w
- failed to set analyzer setting %q with value %q: %w
- settings key %q must be valid analyzer name, valid analyzers
- failed to configure analyzer %s: %w
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/dcd73a396d594c6b.
Report an issue: GitHub.