matryer/xbar · error

starting new app failed

Error message

starting new app failed

What it means

Raised in Updater.Restart after an update was applied: the freshly downloaded executable could not be spawned as a new process (cmd.Start failed, possibly with a non-zero exit code reported via *exec.ExitError). The app was updated on disk but the handoff to the new version failed, so the updated build is not running and the process must decide whether to continue or abort.

Source

Thrown at pkg/update/update.go:104

		return errors.Wrap(err, "get executable")
	}
	log.Println("restarting", thisExecuable)
	cmd := exec.Command(thisExecuable)
	cmd.SysProcAttr = &syscall.SysProcAttr{
		Setpgid: false,
	}
	cmd.Dir = filepath.Dir(thisExecuable)
	cmd.Env = os.Environ()
	cmd.Env = append(cmd.Env, "XBAR_UPDATE_RESTART_COUNTER=1")
	cmd.Args = os.Args
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	err = cmd.Start()
	if err != nil {
		if exitErr, ok := err.(*exec.ExitError); ok {
			return errors.Wrapf(err, "starting new app failed: exit code %d", exitErr.ExitCode())
		}
		return errors.Wrap(err, "starting new app failed")
	}
	log.Println("waiting before terminating after update...")
	time.Sleep(1 * time.Second)
	log.Println("terminating after update.")
	os.Exit(0)
	return nil
}

// getLatestRelease gets the latest release.
func (u *Updater) getLatestRelease() (*Release, error) {
	resp, err := u.Client.Get(u.LatestReleaseGitHubEndpoint)
	if err != nil {
		return nil, errors.Wrap(err, "get latest release")
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return nil, errors.Errorf("failed to check for updates: got %s", resp.Status)
	}

View on GitHub (pinned to d624239058)

Solutions

  1. Check that the executable at thisExecuable exists, has the execute bit set, and was not quarantined or corrupted during the update
  2. Verify the new binary matches the current OS/architecture before replacing the running app
  3. Retry cmd.Start() after a short delay in case of transient fork/exec failures
  4. Inspect the wrapped *exec.ExitError exit code and stderr output from the new process to diagnose why it exited immediately
  5. Fall back to keeping the previous app version (appPath.previous) and reporting the failed restart instead of exiting
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pkg/update/update.go:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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