{"record":{"id":"e98a77bd7bfb4ab3","repo":"xai-org/grok-build","slug":"auto-update-failed","errorCode":null,"errorMessage":"Auto-update failed: {:#}\n\n{}","messagePattern":"Auto-update failed: (.+?)\n\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/codegen/xai-grok-update/src/auto_update.rs","lineNumber":976,"sourceCode":"    };\n    let to_version = match &result {\n        Ok(Some(installed)) => Some(installed.clone()),\n        _ => target.map(str::to_string),\n    };\n    xai_grok_telemetry::session_ctx::log_event(CliUpdate {\n        outcome,\n        trigger,\n        from_version,\n        to_version,\n        channel: CliUpdateChannel::from_channel_str(&update_config.channel),\n        installer: CliUpdateInstaller::from_installer_str(installer),\n        platform: platform_label(),\n        rosetta: running_under_rosetta_on_apple_silicon(),\n        duration_ms,\n        error_kind,\n    });\n    result.map(|_| ()).map_err(|e| {\n        anyhow::anyhow!(\n            \"Auto-update failed: {:#}\\n\\n{}\",\n            e,\n            reinstall_hint(installer, &update_config.channel)\n        )\n    })\n}\n\n/// Detect the platform (os, arch) to download binaries for.\n///\n/// Arch is the compile-time arch with one correction: an x86_64 build on an\n/// Apple Silicon host (Rosetta) selects `aarch64`, so every update path —\n/// interactive `grok update`, background `--auto` children, the leader's\n/// hourly converge, and forced minimum-version installs — converges to the\n/// native build instead of perpetuating the translated one. This mirrors\n/// install.sh's `hw.optional.arm64` probe; without it, a lingering x86_64\n/// process would reinstall x86_64 right over a fresh native install.\npub(crate) fn detect_platform() -> Result<(&'static str, &'static str)> {\n    let os = if cfg!(target_os = \"macos\") {","sourceCodeStart":958,"sourceCodeEnd":994,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-update/src/auto_update.rs#L958-L994","documentation":"run_install_script performs the actual auto-update install and records telemetry about the attempt; on failure it wraps the underlying error chain with `{:#}` (all anyhow sources) plus a reinstall_hint containing manual reinstall instructions for the current installer and channel. This is the top-level wrapper, so the root cause is in the nested error text, and the appended hint gives the manual fallback.","triggerScenarios":"Calling run_update or ensure_latest_on_disk when the install script fails — download integrity failure, script execution error, permission problem writing the install location, or unsupported platform/installer combination.","commonSituations":"No write permission to the install directory (e.g. system-managed locations); a partially downloaded or corrupted artifact failing checksum; proxy/firewall blocking the artifact download; Rosetta/Apple Silicon edge cases selecting the wrong installer.","solutions":["Read the `{:#}` portion of the message for the root-cause error chain first","Follow the reinstall_hint's manual reinstall commands to recover immediately","Check write permissions on the install directory or reinstall with elevated/instructions-based install","Retry after checking network/proxy issues if the root cause was download-related"],"exampleFix":"// before\nresult.map(|_| ()).map_err(|e| {\n    anyhow::anyhow!(\"Auto-update failed: {:#}\\n\\n{}\", e, reinstall_hint(installer, &update_config.channel))\n})\n// after\nresult.map(|_| ()).map_err(|e| {\n    eprintln!(\"auto-update failed: {:#}; falling back to manual reinstall\", e);\n    anyhow::anyhow!(\"Auto-update failed: {:#}\\n\\n{}\", e, reinstall_hint(installer, &update_config.channel))\n})","handlingStrategy":"try-catch","validationCode":"// pre-check install dir writability and artifact reachability\nlet dir = install_dir();\nif !is_writable(&dir) { eprintln!(\"install dir not writable: {}\", dir.display()); }\n// HEAD the artifact URL before running the update","typeGuard":null,"tryCatchPattern":"match ensure_latest_on_disk(&cfg).await {\n    Err(e) => {\n        eprintln!(\"{e:#}\"); // walk the full source chain for the root cause\n        eprintln!(\"falling back to manual reinstall per hint\");\n        run_manual_reinstall()?;\n    }\n    Ok(()) => {}\n}","preventionTips":["Read the full `{:#}` error chain before guessing at causes","Use the appended reinstall_hint as the recovery path","Verify install directory permissions before auto-update","Check network/proxy stability for artifact downloads"],"tags":["auto-update","installation","process"],"backgroundTag":"auto-update-install-failed","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}