lbjlaq/Antigravity-Manager · error

brew_exec_failed

brew_exec_failed

Error message

brew_exec_failed

What it means

brew_upgrade_cask (src-tauri/src/modules/update_checker.rs) runs `/opt/homebrew/bin/brew` (or /usr/local/bin/brew) via tokio::process::Command to `brew upgrade --cask antigravity-tools`. 'brew_exec_failed' is returned when the process itself could not be spawned or failed before producing output (the Ok(Err(e)) arm of the output match) — e.g. the brew binary is not executable, is corrupted, or the spawn call errored. It is distinct from brew_timeout (3-minute limit hit) and from brew exit-code failures.

Solutions

  1. Verify the brew binary is executable and works: run `/opt/homebrew/bin/brew --version` (or /usr/local/bin/brew) in Terminal; reinstall Homebrew if it errors.
  2. Reinstall/repair Homebrew (`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`) if the binary is corrupted or the install was partially removed.
  3. Check the binary matches your CPU architecture (arm64 brew under /opt/homebrew, x86_64 under /usr/local); remove the wrong-architecture install.
  4. Clear quarantine attributes if present: `xattr -d com.apple.quarantine /opt/homebrew/bin/brew`.
  5. Retry the in-app upgrade after confirming brew works from the command line; the error is a one-shot spawn failure, not a stateful condition.

Example fix

// before: app reports brew_exec_failed because /opt/homebrew/bin/brew lost +x
// terminal check & fix:
ls -l /opt/homebrew/bin/brew          // -rw-r--r-- (not executable)
chmod +x /opt/homebrew/bin/brew
brew --version                        // after: works, in-app upgrade succeeds
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check brew executability before invoking the upgrade command
import { existsSync, accessSync, constants } from 'fs';
const brew = ['/opt/homebrew/bin/brew', '/usr/local/bin/brew'].find(p => {
  try { accessSync(p, constants.X_OK); return true; } catch { return false; }
});
if (!brew) throw new Error('brew binary missing or not executable');

Try / catch

try {
  await invoke('brew_upgrade_cask');
} catch (e) {
  if (e === 'brew_exec_failed') {
    // guide user to repair Homebrew / check brew binary in Terminal
    showRepairHomebrewDialog();
  } else throw e;
}

Prevention

When it happens

Trigger: tokio::process::Command::output() returns Err while running brew upgrade — brew binary exists at the checked path but cannot be executed (bad permissions, broken symlink, architecture mismatch), the fork/exec failed, or resource limits prevented spawning the child process.

Common situations: Homebrew partially uninstalled or migrated (leftover non-executable /opt/homebrew/bin/brew); Intel vs Apple Silicon path pointing at a stale binary; macOS quarantine/xattr flags on brew; PATH/env corruption inside the GUI app context; disk-full or sandbox preventing process spawn.

Related errors


AI-assisted analysis of lbjlaq/Antigravity-Manager@90a2b6b207 (2026-09-19). Data as JSON: /api/errors/3a4b5317548de547. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/modules/update_checker.rs:522

        "/usr/local/bin/brew"
    } else {
        return Err("brew_not_found".to_string());
    };

    // 3 min timeout to prevent hanging
    let result = tokio::time::timeout(
        std::time::Duration::from_secs(180),
        tokio::process::Command::new(brew_path)
            .args(["upgrade", "--cask", "antigravity-tools"])
            .output(),
    )
    .await;

    let output = match result {
        Ok(Ok(output)) => output,
        Ok(Err(e)) => {
            logger::log_error(&format!("Failed to execute brew upgrade: {}", e));
            return Err("brew_exec_failed".to_string());
        }
        Err(_) => {
            logger::log_error("Homebrew upgrade timed out after 3 minutes");
            return Err("brew_timeout".to_string());
        }
    };

    let stdout = String::from_utf8_lossy(&output.stdout).to_string();
    let stderr = String::from_utf8_lossy(&output.stderr).to_string();

    if output.status.success() {
        logger::log_info(&format!("Homebrew upgrade succeeded: {}", stdout));
        Ok(stdout)
    } else {
        logger::log_error(&format!(
            "brew upgrade failed - stdout: {} stderr: {}",
            stdout, stderr
        ));

View on GitHub (pinned to 90a2b6b207)