{"record":{"id":"03745ba71b73c3de","repo":"matryer/xbar","slug":"missing-xbar-desc","errorCode":null,"errorMessage":"missing xbar.desc","messagePattern":"missing xbar\\.desc","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/metadata/plugin_metadata.go","lineNumber":74,"sourceCode":"\t// to contact the author.\n\tAboutURL string `json:\"aboutURL\"`\n\t// LastUpdated is when this data was last updated.\n\tLastUpdated time.Time `json:\"lastUpdated\"`\n\t// Vars are the configurable values for this Plugin.\n\tVars []PluginVar `json:\"vars\"`\n\n\t// ProcessingNotes is a list of errors/warnings/notes that are set during\n\t// the processing of this plugin.\n\tProcessingNotes []string `json:\"processingNotes\"`\n}\n\n// Validate checks the plugin data.\nfunc (p Plugin) Validate() error {\n\tif p.Title == \"\" {\n\t\treturn errors.New(\"missing xbar.title\")\n\t}\n\tif p.Desc == \"\" {\n\t\treturn errors.New(\"missing xbar.desc\")\n\t}\n\tif !HasImage(p.ImageURL) {\n\t\treturn errors.New(\"missing xbar.image\")\n\t}\n\tif len(p.Authors) == 0 {\n\t\treturn errors.New(\"missing xbar.author\")\n\t}\n\treturn nil // ok\n}\n\n// NiceDesc gets a nice description.\nfunc (p Plugin) NiceDesc() string {\n\tif p.Desc == \"\" {\n\t\treturn p.Title\n\t}\n\treturn truncate(p.Desc, 75)\n}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/metadata/plugin_metadata.go#L56-L92","documentation":"This is a validation guard inside Plugin.Validate: it fires when a parsed plugin's metadata struct has an empty Desc field, i.e. the plugin source did not declare the xbar.desc metadata key. It is one of a series of sequential checks (title first, then description) that reject plugin metadata that xbar requires to display the plugin properly.","triggerScenarios":"Plugin.Validate called on a Plugin whose Desc field is empty — the plugin script lacks an <xbar.desc>...</xbar.desc> comment block or it contains only whitespace.","commonSituations":"New plugins created from a minimal template without the desc comment; author wrote only a title and jumped straight to code; desc accidentally deleted during refactor; generated metadata where Desc was never assigned.","solutions":["Add an <xbar.desc>Short description of what this plugin does</xbar.desc> comment block to the plugin script","Set the Desc field on the Plugin struct before Validate","Re-run Parse on the fixed plugin source and Validate again"],"exampleFix":"// before (plugin script metadata)\n// <xbar.desc></xbar.desc>\n// after\n// <xbar.desc>Shows current CPU usage with sparkline</xbar.desc>","handlingStrategy":"validation","validationCode":"func hasDesc(src string) bool {\n\treturn regexp.MustCompile(`(?s)<xbar\\.desc>\\s*\\S.*?</xbar\\.desc>`).MatchString(src)\n}","typeGuard":"func hasValidDesc(p metadata.Plugin) bool {\n\treturn strings.TrimSpace(p.Desc) != \"\"\n}","tryCatchPattern":"if err := plugin.Validate(); err != nil {\n\tif err.Error() == \"missing xbar.desc\" {\n\t\treturn fmt.Errorf(\"plugin %s: add an <xbar.desc> comment block: %w\", path, err)\n\t}\n\treturn err\n}","preventionTips":["Include a one-line description in every plugin template","Validate all metadata fields together in CI to surface every gap at once","Write the desc comment immediately after the title","Treat empty metadata comments as build failures"],"tags":["metadata","validation","plugin","go"],"backgroundTag":"missing-metadata-field","analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}