{"record":{"id":"90be686fed677e08","repo":"golangci/golangci-lint","slug":"the-sort-order-name-q-is-repeated-several-times","errorCode":null,"errorMessage":"the sort-order name %q is repeated several times","messagePattern":"the sort-order name %q is repeated several times","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/output.go","lineNumber":41,"sourceCode":"\t}\n\n\tfor _, v := range validators {\n\t\tif err := v(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (o *Output) validateSortOrder() error {\n\tvalidOrders := []string{\"linter\", \"file\", \"severity\"}\n\n\tall := strings.Join(o.SortOrder, \" \")\n\n\tfor _, order := range o.SortOrder {\n\t\tif strings.Count(all, order) > 1 {\n\t\t\treturn fmt.Errorf(\"the sort-order name %q is repeated several times\", order)\n\t\t}\n\n\t\tif !slices.Contains(validOrders, order) {\n\t\t\treturn fmt.Errorf(\"unsupported sort-order name %q\", order)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (o *Output) validatePathMode() error {\n\tswitch o.PathMode {\n\tcase \"\", fsutils.OutputPathModeAbsolute:\n\t\t// Valid\n\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported output path mode %q\", o.PathMode)\n\t}","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/output.go#L23-L59","documentation":"This error is thrown during output config validation when the same sort-order name appears more than once in the SortOrder list. The validator joins all entries with spaces and counts occurrences of each name; any count greater than 1 fails. golangci-lint only supports 'linter', 'file', and 'severity' as sort keys, and repeating one makes the ordering ambiguous.","triggerScenarios":"Setting output.sort-order in the YAML config (e.g. [\"severity\", \"severity\"]) or calling Output.Validate() via validateSortOrder with a duplicated name.","commonSituations":"Copy-pasting a sort key when editing .golangci.yml; merging config fragments that each append the same sort key; forgetting the field is a list of distinct keys.","solutions":["Remove the duplicated entry from output.sort-order in your config so each of 'linter', 'file', 'severity' appears at most once","Keep only the keys you need in the desired precedence order, e.g. [\"file\", \"linter\"]"],"exampleFix":"// before\noutput:\n  sort-order:\n    - linter\n    - severity\n    - severity\n// after\noutput:\n  sort-order:\n    - linter\n    - severity","handlingStrategy":"validation","validationCode":"orders := cfg.Output.SortOrder\nseen := map[string]bool{}\nvalid := map[string]bool{\"linter\": true, \"file\": true, \"severity\": true}\nfor _, o := range orders {\n  if seen[o] || !valid[o] {\n    return fmt.Errorf(\"invalid or duplicated sort-order %q\", o)\n  }\n  seen[o] = true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep sort-order entries unique and limited to linter, file, severity","Validate config with golangci-lint config verify before CI runs","Avoid hand-merging sort-order lists from multiple config fragments"],"tags":["config","validation","golangci-lint"],"backgroundTag":"invalid-config-value","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}