matryer/xbar · error

run in terminal script failed: %s

Error message

run in terminal script failed: %s

What it means

On Windows, runInTerminal runs a helper script that opens the plugin in a terminal window. Run errors are logged but ignored; if the script process itself exits non-zero, this error is returned including the script's stderr output.

Source

Thrown at pkg/plugins/plugin_windows.go:28

// Setpgid is a no-op in Windows
func Setpgid(cmd *exec.Cmd) {
}

func (p *Plugin) runInTerminal(appleScriptTemplate3, command, paramsStr string, vars []string) error {

	log.Println(p.Command, "RunInTerminal", command)
	cmd := exec.Command("start", "cmd", "/k", command)
	cmd.Env = append(cmd.Env, vars...)

	var stderr bytes.Buffer
	cmd.Stderr = &stderr
	err := cmd.Run()
	if err != nil {
		p.Debugf("(ignoring) RunInTerminal failed: %s", err)
	}
	if cmd.ProcessState != nil && cmd.ProcessState.ExitCode() != 0 {
		return errors.Errorf("run in terminal script failed: %s", stderr.String())
	}
	return nil
}

View on GitHub (pinned to d624239058)

Solutions

  1. Read the stderr embedded in the error to identify the failing step
  2. Verify cmd.exe / Windows Terminal can launch (check group policy, antivirus)
  3. Check the plugin path for special characters and move it to a simple path
  4. Run the plugin command directly to confirm it works outside the helper script

Example fix

// before
C:\Users\Jürgen\Plugins\my.5m.sh   // non-ASCII path breaks helper
// after
C:\Plugins\my.5m.sh                  // simple ASCII path
Defensive patterns

Strategy: fallback

Try / catch

if err := p.runInTerminal(ctx); err != nil {
    log.Printf("terminal open failed: %v", err)
    return runDirect(ctx) // fall back to non-interactive execution
}

Prevention

When it happens

Trigger: cmd.Run() returns with ProcessState.ExitCode() != 0 for the Windows terminal helper — e.g. cmd/conhost cannot spawn, the script path contains characters the shell mishandles, or the inner command fails inside the terminal.

Common situations: Windows environments where cmd.exe is restricted by policy, non-ASCII plugin paths causing script failures, antivirus blocking script execution, or the plugin command failing when launched in the new terminal.

Related errors


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