{"record":{"id":"28bfde01cd95fca5","repo":"junegunn/fzf","slug":"invalid-format-str","errorCode":null,"errorMessage":"invalid format: ${str}","messagePattern":"invalid format: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":842,"sourceCode":"func atoi(str string) (int, error) {\n\tnum, err := strconv.Atoi(str)\n\tif err != nil {\n\t\treturn 0, errors.New(\"not a valid integer: \" + str)\n\t}\n\treturn num, nil\n}\n\nfunc atof(str string) (float64, error) {\n\tnum, err := strconv.ParseFloat(str, 64)\n\tif err != nil {\n\t\treturn 0, errors.New(\"not a valid number: \" + str)\n\t}\n\treturn num, nil\n}\n\nfunc splitNth(str string) ([]Range, error) {\n\tif match, _ := regexp.MatchString(\"^[0-9,-.]+$\", str); !match {\n\t\treturn nil, errors.New(\"invalid format: \" + str)\n\t}\n\n\ttokens := strings.Split(str, \",\")\n\tranges := make([]Range, len(tokens))\n\tfor idx, s := range tokens {\n\t\tr, ok := ParseRange(&s)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"invalid format: \" + str)\n\t\t}\n\t\tranges[idx] = r\n\t}\n\treturn ranges, nil\n}\n\nfunc nthTransformer(str string) (func(Delimiter) func([]Token, int32) string, error) {\n\t// ^[0-9,-.]+$\"\n\tif match, _ := regexp.MatchString(\"^[0-9,-.]+$\", str); match {\n\t\tnth, err := splitNth(str)","sourceCodeStart":824,"sourceCodeEnd":860,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L824-L860","documentation":"First rejection point in splitNth: the input to an nth-selecting option (--nth in range form) must match ^[0-9,-.]+$ before parsing. Anything containing other characters — letters, spaces, quotes — fails immediately with 'invalid format'.","triggerScenarios":"Calling fzf --nth '1,3-5' is fine; --nth '1, 3' (space), --nth '1..3' style mistakes are fine, but --nth 'foo', --nth '\"1\"' (embedded quotes), or --nth '1;' fails this regex gate.","commonSituations":"Shell quoting mistakes that leak quote characters into the value; using Haskell-style '..' separators or regex-ish syntax fzf does not support; trailing semicolons from copy-pasted commands.","solutions":["Rewrite the --nth value using only digits, commas, hyphens and dots: --nth 1,3-5","Fix shell quoting so quotes/spaces are not part of the value","Use '..' ranges in the supported form 1..3 (dots are allowed by the regex) or 1-3","For regex/field matching use --nth with fzf's field regex syntax only where documented (e.g. --nth ,.. for last field)"],"exampleFix":"# before\nfzf --nth '1, 3-5'\n# after\nfzf --nth 1,3-5","handlingStrategy":"validation","validationCode":"NTH='1,3-5'\n[[ \"$NTH\" =~ ^[0-9.,-]+$ ]] || { echo \"bad --nth: $NTH\" >&2; exit 1; }\nfzf --nth \"$NTH\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict --nth input to digits, commas, hyphens and dots","Quote the --nth argument so shell word-splitting cannot inject spaces","Build nth lists programmatically instead of hand-editing long strings"],"tags":["fzf","options-parsing","nth","validation","go"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}