{"record":{"id":"2632dd89f74ac355","repo":"junegunn/fzf","slug":"invalid-sort-criterion-str","errorCode":null,"errorMessage":"invalid sort criterion: ${str}","messagePattern":"invalid sort criterion: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":1399,"sourceCode":"\t\t\t}\n\t\t\tcriteria = append(criteria, byPathname)\n\t\tcase \"length\":\n\t\t\tif err := check(&hasLength, \"length\"); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcriteria = append(criteria, byLength)\n\t\tcase \"begin\":\n\t\t\tif err := check(&hasBegin, \"begin\"); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcriteria = append(criteria, byBegin)\n\t\tcase \"end\":\n\t\t\tif err := check(&hasEnd, \"end\"); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcriteria = append(criteria, byEnd)\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"invalid sort criterion: \" + str)\n\t\t}\n\t}\n\tif len(criteria) > 4 {\n\t\treturn nil, errors.New(\"at most 3 tiebreaks are allowed: \" + str)\n\t}\n\treturn criteria, nil\n}\n\nfunc dupeTheme(theme *tui.ColorTheme) *tui.ColorTheme {\n\tdupe := *theme\n\treturn &dupe\n}\n\nfunc parseTheme(defaultTheme *tui.ColorTheme, str string) (*tui.ColorTheme, *tui.ColorTheme, error) {\n\tvar err error\n\tvar baseTheme *tui.ColorTheme\n\ttheme := dupeTheme(defaultTheme)\n\trrggbb := regexp.MustCompile(\"^#[0-9a-fA-F]{6}$\")","sourceCodeStart":1381,"sourceCodeEnd":1417,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L1381-L1417","documentation":"The default branch of parseTiebreak's switch: a comma token in --tiebreak that is not one of index|chunk|length|begin|end|pathname (after lowercasing) is rejected. Typical victims are typos, plurals, and criteria from newer/older fzf versions.","triggerScenarios":"--tiebreak chars (not a criterion), --tiebreak lengths (plural), --tiebreak score (score is implicit and not allowed), --tiebreak time, empty tokens from a trailing comma.","commonSituations":"Assuming --tiebreak score works since output is score-ordered; using 'pathname' vs 'path' inconsistently; version skew where a criterion name changed between releases; trailing commas in generated options.","solutions":["Use only index|chunk|length|begin|end|pathname: --tiebreak pathname,length","Do not include score — it is always the primary criterion","Remove trailing/double commas that create empty tokens","Check fzf --help for the exact spelling in your version"],"exampleFix":"# before\nfzf --tiebreak score,length\n# after\nfzf --tiebreak length","handlingStrategy":"type-guard","validationCode":"VALID='index chunk length begin end pathname'\nIFS=',' read -ra C <<< \"$(tr 'A-Z' 'a-z' <<< \"$TB\")\"\nfor c in \"${C[@]}\"; do grep -qw \"$c\" <<< \"$VALID\" || { echo \"invalid criterion: $c\" >&2; exit 1; }; done\nfzf --tiebreak \"$TB\"","typeGuard":"isValidFzfTiebreak() { [[ \"$1\" =~ ^(index|chunk|length|begin|end|pathname)$ ]]; }","tryCatchPattern":null,"preventionTips":["Whitelist criteria names in wrapper scripts","Check exact spelling (pathname, not path) against fzf --help","Avoid trailing commas that create empty tokens"],"tags":["fzf","options-parsing","sorting","tiebreak","go"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}