matryer/xbar · error

missing xbar.title

Error message

missing xbar.title

What it means

Plugin.Validate enforces that a plugin's directory metadata contains a non-empty xbar.title value. The title is the plugin's display name in the xbar directory/UI, so a plugin without one is considered invalid and rejected. This is the first check in Validate, so it fires before any other missing-field errors.

Source

Thrown at pkg/metadata/plugin_metadata.go:71

	// Dependencies are a list of explicit dependencies this plugin requires to run.
	Dependencies []string `json:"dependencies"`
	// AboutURL is the public URL to learn more about the plugin, including
	// 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
	}

View on GitHub (pinned to d624239058)

Solutions

  1. Add an <xbar.title>My Plugin Name</xbar.title> comment block to the plugin script
  2. Set the Title field on the Plugin struct before calling Validate
  3. Re-parse the plugin metadata with Parse after fixing the source so Title is populated

Example fix

// before (plugin script metadata)
// <xbar.title></xbar.title>
// after
// <xbar.title>CPU Monitor</xbar.title>
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling Plugin.Validate (or code paths that call it, such as metadata parsing/validation pipelines) on a Plugin struct whose Title field is empty because the plugin source lacks an <xbar.title>...</xbar.title> comment or the field was never populated.

Common situations: Plugin authors forgetting the xbar.title metadata comment when creating a new plugin; title stripped by a template or generator; metadata parsed from a file missing the comment due to an editor or linter removal; programmatically built Plugin structs with Title left as the zero value.

Related errors


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