{"record":{"id":"af871771b561cf34","repo":"charmbracelet/gum","slug":"invalid-option-format-q","errorCode":null,"errorMessage":"invalid option format: %q","messagePattern":"invalid option format: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"choose/command.go","lineNumber":44,"sourceCode":"\t} else if len(o.Options) == 0 {\n\t\tif input == \"\" {\n\t\t\treturn errors.New(\"no options provided, see `gum choose --help`\")\n\t\t}\n\t\to.Options = strings.Split(input, o.InputDelimiter)\n\t}\n\n\t// normalize options into a map\n\toptions := map[string]string{}\n\t// keep the labels in the user-provided order\n\tvar labels []string\n\tfor _, opt := range o.Options {\n\t\tif o.LabelDelimiter == \"\" {\n\t\t\toptions[opt] = opt\n\t\t\tcontinue\n\t\t}\n\t\tlabel, value, ok := strings.Cut(opt, o.LabelDelimiter)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"invalid option format: %q\", opt)\n\t\t}\n\t\tlabels = append(labels, label)\n\t\toptions[label] = value\n\t}\n\tif o.LabelDelimiter != \"\" {\n\t\to.Options = labels\n\t}\n\n\tif o.SelectIfOne && len(o.Options) == 1 {\n\t\tfmt.Println(options[o.Options[0]])\n\t\treturn nil\n\t}\n\n\t// We don't need to display prefixes if we are only picking one option.\n\t// Simply displaying the cursor is enough.\n\tif o.Limit == 1 && !o.NoLimit {\n\t\to.SelectedPrefix = \"\"\n\t\to.UnselectedPrefix = \"\"","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/choose/command.go#L26-L62","documentation":"When a --label-delimiter is configured, each option string must split into exactly two parts (label and value) via strings.Cut. Any option that lacks the delimiter cannot be parsed and Run aborts with this error naming the offending option.","triggerScenarios":"Options.Run() iterates options with o.LabelDelimiter != \"\" and strings.Cut(opt, o.LabelDelimiter) returns ok=false — an option string does not contain the configured delimiter.","commonSituations":"Mixing labeled and unlabeled options (e.g. `gum choose --label-delimiter=: a b c:d`); copying option lists from an older gum version or another command that used a different delimiter; shell splitting dropping colons.","solutions":["Ensure every option contains the label delimiter, e.g. gum choose --label-delimiter=: \"name:1\" \"other:2\"","Remove --label-delimiter if you don't need label/value pairs","Sanitize/validate the input list before piping or passing it to gum choose"],"exampleFix":"// before\ngum choose --label-delimiter=: apple banana\n// after\ngum choose --label-delimiter=: \"apple:1\" \"banana:2\"","handlingStrategy":"validation","validationCode":"opts=(\"name:1\" \"other:2\")\nfor opt in \"${opts[@]}\"; do\n  [[ \"$opt\" == *:* ]] || { echo \"bad option: $opt\" >&2; exit 1; }\ndone\ngum choose --label-delimiter=: \"${opts[@]}\"","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Verify every option contains the label delimiter before passing","Avoid mixing labeled and unlabeled options","Keep delimiter consistent across script versions"],"tags":["cli","gum","choose","format"],"backgroundTag":"option-format-invalid","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}