{"record":{"id":"48d5e118c9340ae5","repo":"matryer/xbar","slug":"starting-new-app-failed","errorCode":null,"errorMessage":"starting new app failed","messagePattern":"starting new app failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/update/update.go","lineNumber":104,"sourceCode":"\t\treturn errors.Wrap(err, \"get executable\")\n\t}\n\tlog.Println(\"restarting\", thisExecuable)\n\tcmd := exec.Command(thisExecuable)\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tSetpgid: false,\n\t}\n\tcmd.Dir = filepath.Dir(thisExecuable)\n\tcmd.Env = os.Environ()\n\tcmd.Env = append(cmd.Env, \"XBAR_UPDATE_RESTART_COUNTER=1\")\n\tcmd.Args = os.Args\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\terr = cmd.Start()\n\tif err != nil {\n\t\tif exitErr, ok := err.(*exec.ExitError); ok {\n\t\t\treturn errors.Wrapf(err, \"starting new app failed: exit code %d\", exitErr.ExitCode())\n\t\t}\n\t\treturn errors.Wrap(err, \"starting new app failed\")\n\t}\n\tlog.Println(\"waiting before terminating after update...\")\n\ttime.Sleep(1 * time.Second)\n\tlog.Println(\"terminating after update.\")\n\tos.Exit(0)\n\treturn nil\n}\n\n// getLatestRelease gets the latest release.\nfunc (u *Updater) getLatestRelease() (*Release, error) {\n\tresp, err := u.Client.Get(u.LatestReleaseGitHubEndpoint)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"get latest release\")\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, errors.Errorf(\"failed to check for updates: got %s\", resp.Status)\n\t}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/update/update.go#L86-L122","documentation":"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.","triggerScenarios":"Thrown at pkg/update/update.go:104 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the executable at thisExecuable exists, has the execute bit set, and was not quarantined or corrupted during the update","Verify the new binary matches the current OS/architecture before replacing the running app","Retry cmd.Start() after a short delay in case of transient fork/exec failures","Inspect the wrapped *exec.ExitError exit code and stderr output from the new process to diagnose why it exited immediately","Fall back to keeping the previous app version (appPath.previous) and reporting the failed restart instead of exiting"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}