{"record":{"id":"9737d37ad618e377","repo":"matryer/xbar","slug":"trim","errorCode":null,"errorMessage":"trim","messagePattern":"trim","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/plugins/item_params.go","lineNumber":237,"sourceCode":"\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)\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)","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/plugins/item_params.go#L219-L255","documentation":"This error occurs when the \"trim\" key in a plugin item's parameter string cannot be parsed as a boolean. setValueByKey calls parseBool for the trim value and wraps the failure with the key \"trim\". It means the trim= value controlling whitespace trimming of item text is not a valid boolean literal.","triggerScenarios":"Parsing a param string containing 'trim=on', 'trim=false.', 'trim=' (empty), or any value strconv.ParseBool rejects.","commonSituations":"Plugin authors hand-edit metadata and use yes/off or add stray punctuation/whitespace; templated scripts that emit an empty value (trim=) when a variable is unset also hit this.","solutions":["Use trim=true or trim=false (1/0, t/f also accepted).","Remove trailing punctuation or whitespace from the value.","Ensure shell variables feeding the value are set and expand to true/false, otherwise the emitted value is empty.","Remove the trim key entirely if you want the default (trim is true by default)."],"exampleFix":"// before\nparams := \"trim=off\"\n// after\nparams := \"trim=false\"","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\n}\n// validBoolParam(\"trim=on\", \"trim\") == 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    if strings.Contains(err.Error(), \"trim\") {\n        log.Printf(\"invalid trim value in %q: %v\", raw, err)\n        return // skip item or use defaults\n    }\n}","preventionTips":["Use trim=true/trim=false only; note trim defaults to true so you can often omit it.","Strip invisible characters when copying metadata from docs or chat.","Ensure generated values are literal true/false, never empty.","Lint plugin output for boolean params in CI."],"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"}