henrygd/beszel · error

the executable in the extracted path is missing or it is ina

Error message

the executable in the extracted path is missing or it is inaccessible: %v, %v

What it means

After extraction, update() looks for Config.ArchiveExecutable inside the extracted directory, retrying once with an ".exe" suffix for Windows-style archives. If neither path exists or is accessible via os.Stat, the update aborts with this message reporting both stat errors. It means the archive didn't contain the expected binary at the expected name — or extraction went somewhere unexpected.

Source

Thrown at internal/ghupdate/ghupdate.go:189

	if err := extract(assetPath, extractDir); err != nil {
		return false, err
	}

	ColorPrint(ColorYellow, "Replacing the executable...")

	oldExec, err := os.Executable()
	if err != nil {
		return false, err
	}
	renamedOldExec := oldExec + ".old"
	defer os.Remove(renamedOldExec)

	newExec := filepath.Join(extractDir, p.config.ArchiveExecutable)
	if _, err := os.Stat(newExec); err != nil {
		// try again with an .exe extension
		newExec = newExec + ".exe"
		if _, fallbackErr := os.Stat(newExec); fallbackErr != nil {
			return false, fmt.Errorf("the executable in the extracted path is missing or it is inaccessible: %v, %v", err, fallbackErr)
		}
	}

	// rename the current executable
	if err := os.Rename(oldExec, renamedOldExec); err != nil {
		return false, fmt.Errorf("failed to rename the current executable: %w", err)
	}

	tryToRevertExecChanges := func() {
		if revertErr := os.Rename(renamedOldExec, oldExec); revertErr != nil {
			slog.Debug(
				"Failed to revert executable",
				slog.String("old", renamedOldExec),
				slog.String("new", oldExec),
				slog.String("error", revertErr.Error()),
			)
		}
	}

View on GitHub (pinned to b38fb7dafa)

Solutions

  1. Verify Config.ArchiveExecutable exactly matches the executable's name inside the release archive (inspect with `tar -tzf <asset>` or list the zip).
  2. Confirm you are downloading the official henrygd/beszel release asset for your GOOS/GOARCH, whose archive layout the package expects.
  3. Check that extraction succeeded (look for files under the .beszel_update-* temp dir) and that antivirus did not remove the extracted binary.
  4. Retry the update; a partial download/extraction can leave the directory incomplete.

Example fix

// before
Update(ghupdate.Config{ArchiveExecutable: "beszel"}) // archive contains "beszel-agent"
// after
Update(ghupdate.Config{ArchiveExecutable: "beszel-agent"})
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the archive layout matches ArchiveExecutable before updating
out, _ := exec.Command("tar", "-tzf", downloadedAsset).Output()
if !bytes.Contains(out, []byte(cfg.ArchiveExecutable)) {
    return fmt.Errorf("archive does not contain %q — fix ArchiveExecutable", cfg.ArchiveExecutable)
}

Try / catch

updated, err := ghupdate.Update(cfg)
if err != nil && strings.Contains(err.Error(), "missing or it is inaccessible") {
    log.Printf("extracted binary not found (%v); verify ArchiveExecutable matches the archive contents", err)
}

Prevention

When it happens

Trigger: ghupdate.Update -> update when neither <extractDir>/<ArchiveExecutable> nor <extractDir>/<ArchiveExecutable>.exe exists after extract(): Config.ArchiveExecutable doesn't match the binary name inside the release archive, extraction failed partially, or the wrong platform's asset was matched by suffix.

Common situations: Configuring ArchiveExecutable as "beszel-agent" while the archive contains it under a versioned subdirectory or a different name; running against a fork's releases with different archive layouts; antivirus quarantining the extracted binary before the stat; running an unofficial/custom release.

Related errors


AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31). Data as JSON: /api/errors/fef7fb7dbdc90bfd. Report an issue: GitHub.