lbjlaq/Antigravity-Manager · error

brew_upgrade_failed

brew_upgrade_failed

Error message

brew_upgrade_failed

What it means

Generic failure branch of brew_upgrade_cask (src-tauri/src/modules/update_checker.rs): when `brew upgrade --cask antigravity-tools` exits with a non-success status and the output does NOT contain "already installed", the command returns 'brew_upgrade_failed' as a structured i18n key, having logged full stdout/stderr. This covers any real brew failure — cask definition errors, checksum mismatches, permission problems moving the app bundle, tap issues, or network download failures.

Solutions

  1. Read the detailed log line 'brew upgrade failed - stdout: ... stderr: ...' (update_checker.rs:537-540) — it contains brew's actual error; fix the root cause it names.
  2. Quit the antigravity-tools app completely and retry, since a running app commonly blocks cask staging into /Applications.
  3. Refresh state then retry manually: `brew update && brew upgrade --cask antigravity-tools`; if checksum fails, run `brew cleanup` and retry to clear a corrupt download cache.
  4. Fix permissions if brew reports them: ensure ~/Library/Caches/Homebrew and /Applications are writable by your user; avoid running brew with sudo (chown -R $(whoami) the reported paths).
  5. If the cask itself is broken or disabled, install the new version directly from the vendor, or `brew uninstall --cask antigravity-tools && brew install --cask antigravity-tools` once the cask is fixed.

Example fix

// before: app running blocks upgrade -> brew_upgrade_failed
brew upgrade --cask antigravity-tools  // Error: It seems the App source ... is already at /Applications
// after: quit the app first
osascript -e 'quit app "antigravity-tools"'
brew upgrade --cask antigravity-tools  // succeeds
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: ensure the app isn't running and brew taps are fresh before upgrading
const { exec } = require('child_process');
exec('pgrep -x antigravity-tools', (err, stdout) => {
  if (stdout && stdout.trim()) console.warn('quit the app before brew upgrade to avoid staging failure');
});
exec('brew update', () => console.log('taps refreshed'));

Try / catch

try {
  await invoke('brew_upgrade_cask');
} catch (e) {
  if (e === 'brew_upgrade_failed') {
    // fetch the detailed stdout/stderr from the app log
    // ('brew upgrade failed - stdout: ... stderr: ...') and act on the root cause
    openLogAndDiagnose();
  } else throw e;
}

Prevention

When it happens

Trigger: The spawned brew process completes with a non-zero exit code whose stdout/stderr lacks "already installed" — e.g. cask staging failed, SHA256 checksum verification failed, /Applications write permission denied (app running or owned by root), cask was disabled/renamed, or the download failed mid-transfer.

Common situations: The app being upgraded is currently running so brew cannot move it into /Applications; Homebrew cask definition broken after a vendor release changed the artifact/checksum; partially migrated Homebrew ownership (files owned by root after a sudo misuse); interrupted downloads leaving a corrupt cache in ~/Library/Caches/Homebrew; cask removed or renamed in homebrew/cask.

Related errors


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

Appendix: source

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

            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
        ));
        // Return structured error key for frontend i18n
        if stderr.contains("already installed") || stdout.contains("already installed") {
            Err("brew_already_latest".to_string())
        } else {
            Err("brew_upgrade_failed".to_string())
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_compare_versions() {
        assert!(compare_versions("3.3.36", "3.3.35"));
        assert!(compare_versions("3.4.0", "3.3.35"));
        assert!(compare_versions("4.0.3", "3.3.35"));
        assert!(!compare_versions("3.3.34", "3.3.35"));
        assert!(!compare_versions("3.3.35", "3.3.35"));
    }

View on GitHub (pinned to 90a2b6b207)