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

  1. Use only supported sort-order values (e.g. file, linter, severity) in output.sort-order
  2. Check `golangci-lint help` or docs for your version's supported sort-order names
  3. Fix typos/quotes in .golangci.yml; validate with `golangci-lint config verify` if available
  4. 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

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


AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02). Data as JSON: /api/errors/dcd73a396d594c6b. Report an issue: GitHub.