matryer/xbar · error

missing xbar.author

Error message

missing xbar.author

What it means

Plugin.Validate requires at least one author, i.e. len(p.Authors) > 0. Authorship is required for the directory listing, so a plugin with no <xbar.author> metadata fails validation. This is the last check before Validate returns nil.

Source

Thrown at pkg/metadata/plugin_metadata.go:80

	// 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)
}

// File is a single file.
type File struct {
	// Path is the path of the File.
	Path string `json:"path"`
	// Filename is the file name of this File.
	Filename string `json:"filename"`

View on GitHub (pinned to d624239058)

Solutions

  1. Add an <xbar.author>Your Name, github-username</xbar.author> comment block to the plugin script
  2. Append at least one Author to the Plugin's Authors slice before Validate
  3. Re-parse the fixed source and Validate again

Example fix

// before (plugin script metadata)
// <xbar.author></xbar.author>
// after
// <xbar.author>Jane Doe, janedoe</xbar.author>
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func hasValidAuthors(p metadata.Plugin) bool {
	return len(p.Authors) > 0
}

Try / catch

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

Prevention

When it happens

Trigger: Plugin.Validate called on a Plugin whose Authors slice is empty — the script has no <xbar.author>...</xbar.author> comment, or it contains no name/username and Parse produced zero authors.

Common situations: Forked plugins where the original author line was deleted; new plugin templates lacking the author comment; author username accidentally removed; Plugin structs constructed by hand without appending any Author.

Related errors


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