matryer/xbar · error

parse stdout

Error message

parse stdout

What it means

Plugin.refresh runs the plugin command and then parses its stdout into menu items via parseOutput. If parsing fails, the error is wrapped as 'parse stdout'. This is the central pipeline error: any output-format mistake made by a plugin surfaces here.

Source

Thrown at pkg/plugins/plugin.go:327

	var stdout, stderr bytes.Buffer
	cmd.Stdout = &stdout
	cmd.Stderr = &stderr
	if p.Stdout != nil {
		cmd.Stdout = io.MultiWriter(cmd.Stdout, p.Stdout)
	}
	if p.Stderr != nil {
		cmd.Stderr = io.MultiWriter(cmd.Stderr, p.Stderr)
	}
	if err := cmd.Run(); err != nil {
		return errExec{
			err:    err,
			Stderr: stderr.String(),
		}
	}
	var err error
	p.Items, err = p.parseOutput(ctx, filepath.Base(p.Command), &stdout)
	if err != nil {
		return errors.Wrap(err, "parse stdout")
	}
	return nil
}

// OnErr is called when something has gone wrong at some point.
func (p *Plugin) OnErr(err error) {
	p.Items.CycleItems = []*Item{
		{
			Plugin: p,
			Text:   "⚠️ " + p.CleanFilename(),
		},
	}
	p.Items.ExpandedItems = p.stringToItems(err.Error())
}

// errExec is used for plugin execution errors.
type errExec struct {
	// Stderr is the data captured from stderr.

View on GitHub (pinned to d624239058)

Solutions

  1. Check the wrapped inner error (errors.Cause) for the specific parsing failure
  2. Run the plugin script manually and inspect its stdout for malformed lines
  3. Fix the offending parameter value (color, int, template) in the plugin script
  4. Ensure output is valid UTF-8 and lines are well-formed 'Item | key=value' entries

Example fix

// before
echo "Item | color=blurple"    // invalid named color -> parse fails
// after
echo "Item | color=purple"     // valid named color
Defensive patterns

Strategy: fallback

Try / catch

if err := plugin.Refresh(ctx); err != nil {
    log.Printf("refresh failed: %v (cause: %v)", err, errors.Unwrap(err))
    plugin.SetItems(lastGoodItems) // keep previous menu
}

Prevention

When it happens

Trigger: parseOutput returns an error for the plugin's stdout — malformed item lines that trip the parser (e.g. errors detected during item parsing), or an underlying read failure (see 'reading').

Common situations: Plugin prints malformed parameter blocks (bad color/int values), emits invalid UTF-8 or oversized output, or its output format doesn't match what the parser expects after a library version update.

Related errors


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