{"record":{"id":"80c5274d307f423d","repo":"nikivdev/code","slug":"unsupported-macos-architecture","errorCode":null,"errorMessage":"Unsupported macOS architecture","messagePattern":"Unsupported macOS architecture","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/upgrade.rs","lineNumber":146,"sourceCode":"        elapsed_hours >= UPGRADE_CHECK_INTERVAL_HOURS\n    }\n}\n\n/// Get current version from Cargo.toml embedded at compile time.\npub fn current_version() -> &'static str {\n    env!(\"CARGO_PKG_VERSION\")\n}\n\n/// Detect the current platform (os, arch).\nfn detect_release_target() -> Result<&'static str> {\n    if cfg!(target_os = \"macos\") {\n        if cfg!(target_arch = \"x86_64\") {\n            return Ok(\"x86_64-apple-darwin\");\n        }\n        if cfg!(target_arch = \"aarch64\") {\n            return Ok(\"aarch64-apple-darwin\");\n        }\n        bail!(\"Unsupported macOS architecture\");\n    }\n    if cfg!(target_os = \"linux\") {\n        if cfg!(target_arch = \"x86_64\") {\n            return Ok(\"x86_64-unknown-linux-gnu\");\n        }\n        if cfg!(target_arch = \"aarch64\") {\n            return Ok(\"aarch64-unknown-linux-gnu\");\n        }\n        bail!(\"Unsupported Linux architecture\");\n    }\n\n    bail!(\"Unsupported operating system for self-upgrade (only macOS/Linux supported)\");\n}\n\nfn detect_legacy_platform() -> Result<(&'static str, &'static str)> {\n    let os = if cfg!(target_os = \"macos\") {\n        \"darwin\"\n    } else if cfg!(target_os = \"linux\") {","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/upgrade.rs#L128-L164","documentation":"Raised by `detect_release_target` when the binary runs on macOS but the CPU architecture is neither x86_64 nor aarch64, so no release artifact name can be produced. GitHub release targets only exist for darwin x86_64 and aarch64.","triggerScenarios":"Self-upgrade (`run`) on a Mac whose `cfg!(target_arch)` is not x86_64 or aarch64 at compile time — effectively exotic/older Mac hardware (PowerPC-era or experimental targets) or a cross-compiled build for an unusual architecture.","commonSituations":"Running a cross-compiled binary on unsupported hardware; using builds distributed for uncommon targets; very old hackintosh/VM configurations.","solutions":["Use a binary built for x86_64-apple-darwin or aarch64-apple-darwin.","Update the tool manually instead of self-upgrade (download the release asset directly from GitHub).","Add a matching `cfg!(target_arch)` arm for your architecture and contribute/publish an artifact for it."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match detect_release_target() {\n    Ok(target) => { /* download target asset */ }\n    Err(e) if e.to_string().contains(\"Unsupported macOS\") => {\n        eprintln!(\"no prebuilt asset for this Mac arch; update manually from GitHub releases\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Only distribute/run official builds for x86_64-apple-darwin or aarch64-apple-darwin on macOS.","Detect the arch ahead of time (uname -m) and warn before attempting self-upgrade.","Document manual upgrade steps for unsupported architectures.","Prefer native (not cross-compiled for exotic targets) binaries."],"tags":["macos","architecture","upgrade"],"backgroundTag":"unsupported-architecture","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}