matryer/xbar · error
refresh
Error message
refresh
What it means
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.
Source
Thrown at pkg/plugins/item_params.go:219
}
p.Size = val
case "shell", "bash":
p.Shell = value
case "templateImage":
p.TemplateImage = value
case "image":
p.Image = value
case "terminal":
var err error
p.Terminal, err = parseBool(value)
if err != nil {
return errors.Wrap(err, key)
}
case "refresh":
var err error
p.Refresh, err = parseBool(value)
if err != nil {
return errors.Wrap(err, key)
}
case "dropdown":
var err error
p.Dropdown, err = parseBool(value)
if err != nil {
return errors.Wrap(err, key)
}
case "length":
val, err := parseInt(value)
if err != nil {
return errors.Wrap(err, key)
}
p.Length = val
case "trim":
var err error
p.Trim, err = parseBool(value)
if err != nil {
return errors.Wrap(err, key)View on GitHub (pinned to d624239058)
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.
Example fix
// before params := "refresh=yes" // after params := "refresh=true"
Defensive patterns
Strategy: validation
Validate before calling
func validBoolParam(params string, key string) bool {
for _, kv := range strings.Split(params, ",") {
parts := strings.SplitN(kv, "=", 2)
if len(parts) == 2 && parts[0] == key {
_, err := strconv.ParseBool(parts[1])
return err == nil
}
}
return true // key absent
}
// validBoolParam("refresh=yes", "refresh") == false Type guard
func isGoBool(s string) bool {
_, err := strconv.ParseBool(s)
return err == nil
} Try / catch
if err := item.ParseParams(raw); err != nil {
var keyErr interface{ Key() string }
log.Printf("skipping item: bad %s value in params %q: %v", "refresh", raw, err)
return // or fall back to default params
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of matryer/xbar@d624239058 (2026-09-02).
Data as JSON: /api/errors/19cf4fd63b99234e.
Report an issue: GitHub.