{"record":{"id":"19cf4fd63b99234e","repo":"matryer/xbar","slug":"refresh","errorCode":null,"errorMessage":"refresh","messagePattern":"refresh","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/plugins/item_params.go","lineNumber":219,"sourceCode":"\t\t}\n\t\tp.Size = val\n\tcase \"shell\", \"bash\":\n\t\tp.Shell = value\n\tcase \"templateImage\":\n\t\tp.TemplateImage = value\n\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)","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/plugins/item_params.go#L201-L237","documentation":"This error occurs when the \"refresh\" key in a plugin item's parameter string cannot be parsed as a boolean. setValueByKey calls parseBool, which uses strconv.ParseBool and returns 'expected \"true\" or \"false\", not \"<value>\"' on failure; the error is then wrapped with the key name \"refresh\". It means the refresh= value in your params is not a valid Go boolean literal.","triggerScenarios":"Calling parseParamStr (via ItemParams parsing) with a param string containing 'refresh=...' where the value is not one of 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False — e.g. refresh=yes, refresh=on, refresh= (empty), or a typo like refresh=truee.","commonSituations":"Developers writing SwiftBar-style plugin metadata use shell/INI conventions like yes/on or omit the value (refresh=) after copying examples from other plugin ecosystems; empty values and shell variable interpolation left unexpanded (refresh=$ENABLED) also trigger this.","solutions":["Change the refresh value in the param string to a valid boolean: true or false (also accepted: 1/0, t/f, TRUE/FALSE).","If the value comes from a variable, ensure it is expanded to a literal true/false before parsing (check for unexpanded $VARS or empty values).","If the key is not meant to be a boolean option, rename it (e.g. prefix with param) so it is treated as a shell parameter.","Validate the value in your script before emitting the metadata line, e.g. emit refresh=true only when a condition holds."],"exampleFix":"// before\nparams := \"refresh=yes\"\n// after\nparams := \"refresh=true\"","handlingStrategy":"validation","validationCode":"func validBoolParam(params string, key string) bool {\n    for _, kv := range strings.Split(params, \",\") {\n        parts := strings.SplitN(kv, \"=\", 2)\n        if len(parts) == 2 && parts[0] == key {\n            _, err := strconv.ParseBool(parts[1])\n            return err == nil\n        }\n    }\n    return true // key absent\n}\n// validBoolParam(\"refresh=yes\", \"refresh\") == false","typeGuard":"func isGoBool(s string) bool {\n    _, err := strconv.ParseBool(s)\n    return err == nil\n}","tryCatchPattern":"if err := item.ParseParams(raw); err != nil {\n    var keyErr interface{ Key() string }\n    log.Printf(\"skipping item: bad %s value in params %q: %v\", \"refresh\", raw, err)\n    return // or fall back to default params\n}","preventionTips":["Only emit true/false (or 1/0) for boolean param keys.","Validate metadata lines with a pre-commit or CI check before shipping plugin scripts.","Guard shell variable interpolation so unset variables never produce empty key= values.","Remove boolean keys you do not need instead of leaving them blank."],"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"}