{"record":{"id":"e393ba8873b005fd","repo":"matryer/xbar","slug":"alternate","errorCode":null,"errorMessage":"alternate","messagePattern":"alternate","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/plugins/item_params.go","lineNumber":243,"sourceCode":"\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)\n\t\t}\n\tcase \"emojize\":\n\t\tvar err error\n\t\tp.Emojize, err = parseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)\n\t\t}\n\tcase \"ansi\":\n\t\tvar err error\n\t\tp.ANSI, err = parseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, key)\n\t\t}\n\tdefault:\n\t\tif strings.HasPrefix(key, \"param\") {\n\t\t\tparamIndex, err := strconv.Atoi(key[5:])\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Errorf(\"bad parameter: %s (should be paramN)\", key)","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/plugins/item_params.go#L225-L261","documentation":"This error occurs when the \"alternate\" key in a plugin item's parameter string cannot be parsed as a boolean. setValueByKey calls parseBool for the alternate value and wraps the failure with the key \"alternate\". It means the alternate= value (controlling alternate dropdown-line display) is not a valid boolean literal.","triggerScenarios":"Parsing a param string containing 'alternate=yes', 'alternate=TRUE.' with stray characters, 'alternate=' (empty), or any other non-boolean value.","commonSituations":"Authors toggling alternate line display copy conventions from YAML (yes/no) or JSON (true with quotes stripped), or scripts emit an empty value when a flag variable is unset.","solutions":["Set alternate=true or alternate=false (1/0, t/f also accepted).","Fix stray characters or whitespace around the value.","Guard the emitting script so it writes a literal true/false instead of an empty or unexpanded value.","Remove the key if you want the default behavior."],"exampleFix":"// before\nparams := \"alternate=yes\"\n// after\nparams := \"alternate=true\"","handlingStrategy":"validation","validationCode":"re := regexp.MustCompile(`alternate=(true|false|1|0|t|f|TRUE|FALSE|True|False|T|F)\\b`)\nif strings.Contains(params, \"alternate=\") && !re.MatchString(params) {\n    return errors.New(\"alternate must be true or false\")\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(), \"alternate\") {\n        log.Printf(\"bad alternate value in %q: %v\", raw, err)\n        raw = removeParam(raw, \"alternate\")\n    }\n}","preventionTips":["Write alternate=true/false; do not copy yes/no from YAML configs.","When toggling by editing metadata, replace the whole value instead of deleting letters.","Keep generated param strings free of surrounding whitespace.","Test scripts with unset flag variables to catch empty emissions."],"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"}