matryer/xbar · error

missing xbar.desc

Error message

missing xbar.desc

What it means

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.

Source

Thrown at pkg/metadata/plugin_metadata.go:74

	// to contact the author.
	AboutURL string `json:"aboutURL"`
	// LastUpdated is when this data was last updated.
	LastUpdated time.Time `json:"lastUpdated"`
	// Vars are the configurable values for this Plugin.
	Vars []PluginVar `json:"vars"`

	// ProcessingNotes is a list of errors/warnings/notes that are set during
	// the processing of this plugin.
	ProcessingNotes []string `json:"processingNotes"`
}

// Validate checks the plugin data.
func (p Plugin) Validate() error {
	if p.Title == "" {
		return errors.New("missing xbar.title")
	}
	if p.Desc == "" {
		return errors.New("missing xbar.desc")
	}
	if !HasImage(p.ImageURL) {
		return errors.New("missing xbar.image")
	}
	if len(p.Authors) == 0 {
		return errors.New("missing xbar.author")
	}
	return nil // ok
}

// NiceDesc gets a nice description.
func (p Plugin) NiceDesc() string {
	if p.Desc == "" {
		return p.Title
	}
	return truncate(p.Desc, 75)
}

View on GitHub (pinned to d624239058)

Solutions

  1. Add an <xbar.desc>Short description of what this plugin does</xbar.desc> comment block to the plugin script
  2. Set the Desc field on the Plugin struct before Validate
  3. Re-run Parse on the fixed plugin source and Validate again

Example fix

// before (plugin script metadata)
// <xbar.desc></xbar.desc>
// after
// <xbar.desc>Shows current CPU usage with sparkline</xbar.desc>
Defensive patterns

Strategy: validation

Validate before calling

func hasDesc(src string) bool {
	return regexp.MustCompile(`(?s)<xbar\.desc>\s*\S.*?</xbar\.desc>`).MatchString(src)
}

Type guard

func hasValidDesc(p metadata.Plugin) bool {
	return strings.TrimSpace(p.Desc) != ""
}

Try / catch

if err := plugin.Validate(); err != nil {
	if err.Error() == "missing xbar.desc" {
		return fmt.Errorf("plugin %s: add an <xbar.desc> comment block: %w", path, err)
	}
	return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of matryer/xbar@d624239058 (2026-09-02). Data as JSON: /api/errors/03745ba71b73c3de. Report an issue: GitHub.