{"record":{"id":"1fb87c2a2a6bce39","repo":"matryer/xbar","slug":"dropdown","errorCode":null,"errorMessage":"dropdown","messagePattern":"dropdown","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/plugins/item_params.go","lineNumber":225,"sourceCode":"\tcase \"image\":\n\t\tp.Image = value\n\tcase \"terminal\":\n\t\tvar err error\n\t\tp.Terminal, err = parseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)\n\t\t}\n\tcase \"refresh\":\n\t\tvar err error\n\t\tp.Refresh, err = parseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)\n\t\t}\n\tcase \"dropdown\":\n\t\tvar err error\n\t\tp.Dropdown, err = parseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)\n\t\t}\n\tcase \"length\":\n\t\tval, err := parseInt(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)\n\t\t}\n\t\tp.Length = val\n\tcase \"trim\":\n\t\tvar err error\n\t\tp.Trim, err = parseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)\n\t\t}\n\tcase \"alternate\":\n\t\tvar err error\n\t\tp.Alternate, err = parseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/plugins/item_params.go#L207-L243","documentation":"This error occurs when the \"dropdown\" key in a plugin item's parameter string cannot be parsed as a boolean. setValueByKey calls parseBool for the dropdown value; on failure the parse error ('expected \"true\" or \"false\", not \"<value>\"') is wrapped with the key \"dropdown\". It indicates the dropdown= value is not a valid boolean literal.","triggerScenarios":"Parsing a param string like 'dropdown=show', 'dropdown=1 ', 'dropdown=' (empty), or 'dropdown=yes' via parseParamStr — any value strconv.ParseBool rejects.","commonSituations":"Plugin authors control whether an item appears in the dropdown menu and copy conventions like yes/on from YAML or shell configs; trailing whitespace from hand-edited metadata lines and empty values after '=' are the usual culprits.","solutions":["Set dropdown to a valid boolean: dropdown=true or dropdown=false (1/0, t/f also accepted).","Strip whitespace and ensure a non-empty value follows the '=' in the metadata line.","If the value is generated dynamically, coerce it to Go-style true/false before writing the params string.","If it should be an arbitrary string, it does not belong under the dropdown key — use paramN instead."],"exampleFix":"// before\nparams := \"dropdown=yes\"\n// after\nparams := \"dropdown=true\"","handlingStrategy":"validation","validationCode":"re := regexp.MustCompile(`dropdown=(true|false|1|0|t|f|TRUE|FALSE|True|False|T|F)\\b`)\nif !re.MatchString(params) {\n    return fmt.Errorf(\"dropdown value must be true/false, got %q\", params)\n}","typeGuard":"func isGoBool(s string) bool {\n    _, err := strconv.ParseBool(strings.TrimSpace(s))\n    return err == nil\n}","tryCatchPattern":"if err := item.ParseParams(raw); err != nil {\n    if strings.Contains(err.Error(), \"dropdown\") {\n        log.Printf(\"invalid dropdown value in %q: %v\", raw, err)\n        params = defaultParams // fall back to defaults\n    }\n}","preventionTips":["Write dropdown=true or dropdown=false verbatim; never yes/no/on/off.","Avoid trailing whitespace after the value in metadata lines.","Test the rendered param string output of your script with edge cases (empty variables).","Omit the key when you want the default (dropdown defaults to true)."],"tags":["go","config-parsing","boolean-parse"],"backgroundTag":"invalid-boolean-value","analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}