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

  1. Correct the key to one of: linter, file, severity
  2. 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

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


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