{"record":{"id":"435195fb3bad236a","repo":"matryer/xbar","slug":"unknown-xbar-var-type-s","errorCode":null,"errorMessage":"unknown xbar.var type: %s","messagePattern":"unknown xbar\\.var type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/metadata/plugin_metadata.go","lineNumber":444,"sourceCode":"\t\t\t\tsrc: s,\n\t\t\t\terr: errors.New(\"malformed xbar.var format (empty select options)\"),\n\t\t\t}\n\t\t}\n\t\tdefaultFound := false\n\t\tfor _, val := range v.Options {\n\t\t\tif val == v.Default {\n\t\t\t\tdefaultFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !defaultFound {\n\t\t\treturn v, errParse{\n\t\t\t\tsrc: s,\n\t\t\t\terr: errors.New(\"malformed xbar.var format (default not in select options)\"),\n\t\t\t}\n\t\t}\n\tdefault: // invalid type\n\t\treturn v, errors.Errorf(\"unknown xbar.var type: %s\", v.Type)\n\t}\n\treturn v, nil\n}\n\ntype errMissingMetadata string\n\nfunc (e errMissingMetadata) Error() string {\n\treturn fmt.Sprintf(\"missing <%[1]s></%[1]s>\", string(e))\n}\n\ntype errParse struct {\n\tsrc string\n\terr error\n}\n\nfunc (e errParse) Error() string {\n\tif e.src != \"\" {\n\t\treturn fmt.Sprintf(\"%s: %q\", e.err, e.src)","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/metadata/plugin_metadata.go#L426-L462","documentation":"parsePluginVar only supports a fixed set of xbar.var types (e.g. string, number, select, checkbox). If the var declaration uses an unrecognized type keyword, the parser falls into the default branch and returns errors.Errorf(\"unknown xbar.var type: %s\", v.Type).","triggerScenarios":"Calling Parse on plugin source whose `<xbar.var>TYPE(...)</xbar.var>` declaration uses a misspelled or unsupported type, e.g. `<xbar.var>str(VAR_X=\"v\")</xbar.var>` or `<xbar.var>integer(VAR_N=5)</xbar.var>`.","commonSituations":"Typo in the type keyword; using a type from a different plugin ecosystem's schema; inventing a type (int, bool) that xbar metadata does not define.","solutions":["Change the var type keyword to a supported one (string, number, select, checkbox)","Fix the typo in the type name in the xbar.var comment","Check xbar plugin API docs for the list of valid var types"],"exampleFix":"// before\n// <xbar.var>integer(VAR_COUNT=5): How many</xbar.var>\n// after\n// <xbar.var>number(VAR_COUNT=5): How many</xbar.var>","handlingStrategy":"validation","validationCode":"// before Parse: check var type keywords\nvalid := map[string]bool{\"string\": true, \"number\": true, \"select\": true, \"checkbox\": true}\nre := regexp.MustCompile(`<xbar\\.var>(\\w+)\\(`)\nfor _, m := range re.FindAllStringSubmatch(pluginSrc, -1) {\n    if !valid[m[1]] {\n        return fmt.Errorf(\"unsupported xbar.var type %q\", m[1])\n    }\n}","typeGuard":null,"tryCatchPattern":"// Go: detect the plain error text\nif _, err := meta.Parse(src); err != nil {\n    if strings.Contains(err.Error(), \"unknown xbar.var type\") {\n        return fmt.Errorf(\"fix plugin metadata: %w\", err)\n    }\n    return err\n}","preventionTips":["Use only documented xbar.var types: string, number, select, checkbox","Add a metadata linter to CI","Never invent type aliases like int or bool"],"tags":["metadata","parsing","validation","plugins"],"backgroundTag":"invalid-enum-value","analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}