{"record":{"id":"48d3d88d7b5dd302","repo":"matryer/xbar","slug":"unknown-parameter-s","errorCode":null,"errorMessage":"unknown parameter: %s","messagePattern":"unknown parameter: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/plugins/item_params.go","lineNumber":270,"sourceCode":"\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)\n\t\t\t}\n\t\t\tfor len(p.ShellParams) < paramIndex {\n\t\t\t\t// ensure the slice is big enough\n\t\t\t\tp.ShellParams = append(p.ShellParams, \"\")\n\t\t\t}\n\t\t\tp.ShellParams[paramIndex-1] = value\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.Errorf(\"unknown parameter: %s\", key)\n\t}\n\treturn nil\n}\n\n// parseBool parses a boolean from a string (either `true` or `false`),\n// returning a nice error if it fails.\nfunc parseBool(s string) (bool, error) {\n\tb, err := strconv.ParseBool(s)\n\tif err != nil {\n\t\treturn false, errors.Errorf(`expected \"true\" or \"false\", not \"%s\"`, s)\n\t}\n\treturn b, nil\n}\n\n// parseColor parses the color value given.\n// Valid values: named color, #RGB, #RGBA, #RRGGBB, #RRGGBBAA.\n// Returns a nice error if it fails.\nfunc parseColor(s string) (string, error) {","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/plugins/item_params.go#L252-L288","documentation":"This error occurs when a key in the plugin item's parameter string matches none of the recognized keys (disabled, key, href, color, font, size, shell, bash, templateImage, image, terminal, refresh, dropdown, length, trim, alternate, emojize, ansi) and does not start with 'param'. setValueByKey returns 'unknown parameter: <key>'. Keys are matched case-sensitively, so 'Refresh' or 'Terminal' also fail.","triggerScenarios":"Parsing a param string with keys like 'option=...', 'icon=...', 'Refresh=true' (wrong case), or 'shellin=...' — any unrecognized key name.","commonSituations":"Authors invent keys based on guesses (icon instead of image), copy keys from other menu bar apps' metadata formats, capitalize keys, or misremember camelCase keys like templateImage as templateimage.","solutions":["Check the key spelling against the supported list and fix it (e.g. icon -> image, templateimage -> templateImage).","Match exact case — keys are case-sensitive (Refresh != refresh).","Remove the unknown key if it has no effect, or move that data into the item content/attributes where appropriate.","For extra values meant for a shell command, use param1=..., param2=... instead of an arbitrary key."],"exampleFix":"// before\nparams := \"icon=.png-battery\"\n// after\nparams := \"image=.png-battery\"","handlingStrategy":"validation","validationCode":"var knownKeys = map[string]bool{\n    \"disabled\": true, \"key\": true, \"href\": true, \"color\": true,\n    \"font\": true, \"size\": true, \"shell\": true, \"bash\": true,\n    \"templateImage\": true, \"image\": true, \"terminal\": true,\n    \"refresh\": true, \"dropdown\": true, \"length\": true, \"trim\": true,\n    \"alternate\": true, \"emojize\": true, \"ansi\": true,\n}\nfor _, kv := range strings.Split(params, \",\") {\n    k := strings.SplitN(kv, \"=\", 2)[0]\n    if !knownKeys[k] && !strings.HasPrefix(k, \"param\") {\n        return fmt.Errorf(\"unknown key %q\", k)\n    }\n}","typeGuard":"func isKnownParamKey(k string) bool {\n    return knownKeys[k] || strings.HasPrefix(k, \"param\")\n}","tryCatchPattern":"if err := item.ParseParams(raw); err != nil {\n    if strings.Contains(err.Error(), \"unknown parameter\") {\n        log.Printf(\"typo in %q: %v\", raw, err)\n        raw = removeParam(raw, offendingKey(err))\n    }\n}","preventionTips":["Copy key names from the library's documented list instead of typing from memory.","Respect exact casing (templateImage, not templateimage; refresh, not Refresh).","Use image= for icons, not icon=.","Add a pre-save validator against the known key set for your plugin scripts."],"tags":["go","config-parsing","unknown-key"],"backgroundTag":"unknown-config-key","analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}