{"record":{"id":"fef7fb7dbdc90bfd","repo":"henrygd/beszel","slug":"the-executable-in-the-extracted-path-is-missing-or","errorCode":null,"errorMessage":"the executable in the extracted path is missing or it is inaccessible: %v, %v","messagePattern":"the executable in the extracted path is missing or it is inaccessible: (.+?), (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ghupdate/ghupdate.go","lineNumber":189,"sourceCode":"\tif err := extract(assetPath, extractDir); err != nil {\n\t\treturn false, err\n\t}\n\n\tColorPrint(ColorYellow, \"Replacing the executable...\")\n\n\toldExec, err := os.Executable()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\trenamedOldExec := oldExec + \".old\"\n\tdefer os.Remove(renamedOldExec)\n\n\tnewExec := filepath.Join(extractDir, p.config.ArchiveExecutable)\n\tif _, err := os.Stat(newExec); err != nil {\n\t\t// try again with an .exe extension\n\t\tnewExec = newExec + \".exe\"\n\t\tif _, fallbackErr := os.Stat(newExec); fallbackErr != nil {\n\t\t\treturn false, fmt.Errorf(\"the executable in the extracted path is missing or it is inaccessible: %v, %v\", err, fallbackErr)\n\t\t}\n\t}\n\n\t// rename the current executable\n\tif err := os.Rename(oldExec, renamedOldExec); err != nil {\n\t\treturn false, fmt.Errorf(\"failed to rename the current executable: %w\", err)\n\t}\n\n\ttryToRevertExecChanges := func() {\n\t\tif revertErr := os.Rename(renamedOldExec, oldExec); revertErr != nil {\n\t\t\tslog.Debug(\n\t\t\t\t\"Failed to revert executable\",\n\t\t\t\tslog.String(\"old\", renamedOldExec),\n\t\t\t\tslog.String(\"new\", oldExec),\n\t\t\t\tslog.String(\"error\", revertErr.Error()),\n\t\t\t)\n\t\t}\n\t}","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/henrygd/beszel/blob/b38fb7dafa60812cc22e6a84ce313e94f1ce0a32/internal/ghupdate/ghupdate.go#L171-L207","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify Config.ArchiveExecutable exactly matches the executable's name inside the release archive (inspect with `tar -tzf <asset>` or list the zip).","Confirm you are downloading the official henrygd/beszel release asset for your GOOS/GOARCH, whose archive layout the package expects.","Check that extraction succeeded (look for files under the .beszel_update-* temp dir) and that antivirus did not remove the extracted binary.","Retry the update; a partial download/extraction can leave the directory incomplete."],"exampleFix":"// before\nUpdate(ghupdate.Config{ArchiveExecutable: \"beszel\"}) // archive contains \"beszel-agent\"\n// after\nUpdate(ghupdate.Config{ArchiveExecutable: \"beszel-agent\"})","handlingStrategy":"validation","validationCode":"// Confirm the archive layout matches ArchiveExecutable before updating\nout, _ := exec.Command(\"tar\", \"-tzf\", downloadedAsset).Output()\nif !bytes.Contains(out, []byte(cfg.ArchiveExecutable)) {\n    return fmt.Errorf(\"archive does not contain %q — fix ArchiveExecutable\", cfg.ArchiveExecutable)\n}","typeGuard":null,"tryCatchPattern":"updated, err := ghupdate.Update(cfg)\nif err != nil && strings.Contains(err.Error(), \"missing or it is inaccessible\") {\n    log.Printf(\"extracted binary not found (%v); verify ArchiveExecutable matches the archive contents\", err)\n}","preventionTips":["Set ArchiveExecutable to the exact binary filename inside the release archive.","Check archive contents with `tar -tzf` / `unzip -l` when switching release sources or forks.","Whitelist the extraction directory in antivirus so the extracted binary survives until the swap.","Re-run the update if extraction was interrupted."],"tags":["archive","extract","configuration","missing-file"],"backgroundTag":"missing-executable-in-archive","analyzedSha":"b38fb7dafa60812cc22e6a84ce313e94f1ce0a32","analyzedAt":"2026-08-31T15:10:10.149Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}