{"record":{"id":"37651a2bd970e30c","repo":"junegunn/fzf","slug":"s-s","errorCode":null,"errorMessage":"%s: %s","messagePattern":"%s: %s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":3919,"sourceCode":"\treturn parser.Parse(str)\n}\n\n// ParseOptions parses command-line options\nfunc ParseOptions(useDefaults bool, args []string) (*Options, error) {\n\topts := defaultOptions()\n\tindex := 0\n\n\tif useDefaults {\n\t\t// 1. Options from $FZF_DEFAULT_OPTS_FILE\n\t\tif path := os.Getenv(\"FZF_DEFAULT_OPTS_FILE\"); path != \"\" {\n\t\t\tbytes, err := os.ReadFile(path)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.New(\"$FZF_DEFAULT_OPTS_FILE: \" + err.Error())\n\t\t\t}\n\n\t\t\twords, parseErr := parseShellWords(string(bytes))\n\t\t\tif parseErr != nil {\n\t\t\t\treturn nil, errors.New(path + \": \" + parseErr.Error())\n\t\t\t}\n\t\t\tif len(words) > 0 {\n\t\t\t\tif err := parseOptions(&index, opts, words); err != nil {\n\t\t\t\t\treturn nil, errors.New(path + \": \" + err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 2. Options from $FZF_DEFAULT_OPTS string\n\t\twords, parseErr := parseShellWords(os.Getenv(\"FZF_DEFAULT_OPTS\"))\n\t\tif parseErr != nil {\n\t\t\treturn nil, errors.New(\"$FZF_DEFAULT_OPTS: \" + parseErr.Error())\n\t\t}\n\t\tif len(words) > 0 {\n\t\t\tif err := parseOptions(&index, opts, words); err != nil {\n\t\t\t\treturn nil, errors.New(\"$FZF_DEFAULT_OPTS: \" + err.Error())\n\t\t\t}\n\t\t}","sourceCodeStart":3901,"sourceCodeEnd":3937,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L3901-L3937","documentation":"The file referenced by $FZF_DEFAULT_OPTS_FILE was read successfully, but its contents could not be split into shell words. fzf uses a shell-like tokenizer (parseShellWords) that understands quoting, so unterminated quotes or malformed escapes make word splitting fail. The error message includes the file path and the tokenizer's reason.","triggerScenarios":"The options file contains an unbalanced quote (e.g. --preview 'cat {} without a closing quote) or an invalid escape sequence, so parseShellWords returns an error before any option is parsed.","commonSituations":"Hand-edited options files where a quote was accidentally deleted; embedding a preview command with nested quotes that ends up unbalanced; copying shell snippets into the file while dropping the closing quote.","solutions":["Open the file and run a quick balance check: grep -c \"'\" and grep -c '\\\"' to spot odd quote counts","Fix or remove the malformed line; prefer double quotes around embedded single quotes","Validate the file in a subshell before relying on it: eval \"set -- $(cat \"$FZF_DEFAULT_OPTS_FILE\")\" and see if the shell also complains"],"exampleFix":"# before ($FZF_DEFAULT_OPTS_FILE contents)\n--preview 'cat {}\n# after\n--preview 'cat {}'","handlingStrategy":"validation","validationCode":"# fail fast on unbalanced quotes before running fzf\nf=\"$FZF_DEFAULT_OPTS_FILE\"\nif [ -n \"$f\" ]; then\n  sq=$(tr -cd \"'\" < \"$f\" | wc -c); dq=$(tr -cd '\\\"' < \"$f\" | wc -c)\n  [ $((sq % 2)) -eq 0 ] && [ $((dq % 2)) -eq 0 ] || { echo 'unbalanced quotes in opts file' >&2; exit 1; }\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep one option per line in the file so a bad line is easy to spot","Lint the file through your shell's parser: bash -n <(cat \"$FZF_DEFAULT_OPTS_FILE\") as a smoke test"],"tags":["fzf","config","parsing","quoting"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}