{"record":{"id":"5801483defedd6de","repo":"lbjlaq/Antigravity-Manager","slug":"brew-timeout","errorCode":"brew_timeout","errorMessage":"brew_timeout","messagePattern":"brew_timeout","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/modules/update_checker.rs","lineNumber":526,"sourceCode":"\n    // 3 min timeout to prevent hanging\n    let result = tokio::time::timeout(\n        std::time::Duration::from_secs(180),\n        tokio::process::Command::new(brew_path)\n            .args([\"upgrade\", \"--cask\", \"antigravity-tools\"])\n            .output(),\n    )\n    .await;\n\n    let output = match result {\n        Ok(Ok(output)) => output,\n        Ok(Err(e)) => {\n            logger::log_error(&format!(\"Failed to execute brew upgrade: {}\", e));\n            return Err(\"brew_exec_failed\".to_string());\n        }\n        Err(_) => {\n            logger::log_error(\"Homebrew upgrade timed out after 3 minutes\");\n            return Err(\"brew_timeout\".to_string());\n        }\n    };\n\n    let stdout = String::from_utf8_lossy(&output.stdout).to_string();\n    let stderr = String::from_utf8_lossy(&output.stderr).to_string();\n\n    if output.status.success() {\n        logger::log_info(&format!(\"Homebrew upgrade succeeded: {}\", stdout));\n        Ok(stdout)\n    } else {\n        logger::log_error(&format!(\n            \"brew upgrade failed - stdout: {} stderr: {}\",\n            stdout, stderr\n        ));\n        // Return structured error key for frontend i18n\n        if stderr.contains(\"already installed\") || stdout.contains(\"already installed\") {\n            Err(\"brew_already_latest\".to_string())\n        } else {","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/lbjlaq/Antigravity-Manager/blob/90a2b6b20797e2e593a83d0c54ab86037863fe70/src-tauri/src/modules/update_checker.rs#L508-L544","documentation":"brew_upgrade_cask (src-tauri/src/modules/update_checker.rs) wraps the `brew upgrade --cask antigravity-tools` invocation in tokio::time::timeout with a 180-second budget. 'brew_timeout' is returned when the elapsed-time future resolves first, i.e. brew did not finish within 3 minutes and the child future is dropped. This is a safety guard so the UI does not hang forever on a stalled brew process.","triggerScenarios":"tokio::time::timeout(Duration::from_secs(180), brew_command.output()) returns Err — brew ran longer than 3 minutes, typically because it was updating itself/other casks, downloading slowly, prompting, waiting on a lock, or hung on network access to formulae.brew.sh or the cask download host.","commonSituations":"Slow or proxied internet making the cask download exceed 3 minutes; concurrent brew operations holding the Homebrew lock (another Terminal brew run); brew auto-updating its own tap first (`brew update` phase); a stuck sudo/prompt-less network credential dialog; heavily loaded CI/VM.","solutions":["Run `brew upgrade --cask antigravity-tools` manually in Terminal to see where it stalls and let it finish once; then retry the in-app upgrade (subsequent runs are usually faster since downloads are cached).","Ensure no other brew process is running (`pgrep -fl brew`) that could hold the Homebrew lock; wait or kill stale processes.","Pre-warm with `brew update` beforehand so the upgrade command skips the slow tap-update phase inside the 3-minute window.","Check network/proxy speed to the cask download URL; use a faster connection or VPN off, then retry.","If timeouts are chronic in your environment, run the upgrade manually and use the app after; the 3-minute timeout is hardcoded in update_checker.rs:510-516."],"exampleFix":"// before: upgrade blocked by concurrent brew holding the lock, hits 180s timeout\n// terminal:\npgrep -fl brew                          // finds stale brew process\nkill <stale_pid>\nbrew update && brew upgrade --cask antigravity-tools   // completes < 3 min\n// after: retry upgrade in app -> succeeds","handlingStrategy":"retry","validationCode":"// Check for a concurrent brew process / lock before triggering the in-app upgrade\nconst { exec } = require('child_process');\nexec('pgrep -fl brew', (err, stdout) => {\n  if (stdout && stdout.trim()) console.warn('another brew process is running; upgrade may time out');\n});","typeGuard":null,"tryCatchPattern":"let ok = false;\nfor (let i = 0; i < 2 && !ok; i++) {\n  try { await invoke('brew_upgrade_cask'); ok = true; }\n  catch (e) {\n    if (e !== 'brew_timeout') throw e;\n    showHint('brew is slow (network/lock). Ensure no other brew run is active, then retry.');\n  }\n}","preventionTips":["Run `brew update` ahead of time so the 3-minute window is spent only on the actual upgrade.","Don't run other brew commands concurrently with the in-app upgrade.","Upgrade on a fast, unproxied connection; large cask downloads can exceed 180s.","If the machine is slow (CI/VM), perform the upgrade manually in Terminal where there is no timeout.","Retry once after a timeout — cached downloads usually make the second attempt finish quickly."],"tags":["homebrew","macos","timeout","update"],"backgroundTag":"request-timeout","analyzedSha":"90a2b6b20797e2e593a83d0c54ab86037863fe70","analyzedAt":"2026-09-19T08:34:01.322Z","contentChangedAt":"2026-09-19T08:34:01.322Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}