{"record":{"id":"0d4416fd0c412580","repo":"nikivdev/code","slug":"unsupported-operating-system-for-self-upgrade-onl","errorCode":null,"errorMessage":"Unsupported operating system for self-upgrade (only macOS/Linux supported)","messagePattern":"Unsupported operating system for self-upgrade \\(only macOS/Linux supported\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/upgrade.rs","lineNumber":158,"sourceCode":"        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\") {\n        \"linux\"\n    } else {\n        bail!(\"Unsupported operating system for self-upgrade (only macOS/Linux supported)\");\n    };\n\n    let arch = if cfg!(target_arch = \"aarch64\") {\n        \"arm64\"\n    } else if cfg!(target_arch = \"x86_64\") {\n        \"amd64\"\n    } else {\n        bail!(\"Unsupported architecture\");\n    };","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/upgrade.rs#L140-L176","documentation":"Self-upgrade is only implemented for macOS and Linux; this error is returned when the upgrade command runs on any other operating system.","triggerScenarios":"Calling the self-upgrade `run` flow on any platform where both `cfg!(target_os = \"macos\")` and `cfg!(target_os = \"linux\")` are false.","commonSituations":"Running the binary natively on Windows, FreeBSD, or inside unusual cross-compilation targets and attempting a self-upgrade.","solutions":["Upgrade manually by downloading the release for your platform","Use the package manager appropriate for the OS"],"exampleFix":"// before\nflow upgrade\n// after\n# on Windows, manually:\n# download the release asset from https://github.com/<owner>/<repo>/releases and replace the binary\n","handlingStrategy":"validation","validationCode":"if !(cfg!(target_os = \"macos\") || cfg!(target_os = \"linux\")) {\n    eprintln!(\"self-upgrade only supports macOS/Linux; use manual download from GitHub releases\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"match flow::upgrade::run() {\n    Err(e) if e.to_string().contains(\"Unsupported operating system\") => {\n        eprintln!(\"manual upgrade required on this OS\");\n    }\n    Err(e) => eprintln!(\"upgrade failed: {e}\"),\n    Ok(()) => {}\n}","preventionTips":["Gate self-upgrade commands behind an OS check in CLI help or startup.","On Windows/BSD, always use the package manager or manual download path.","Use WSL on Windows to get the Linux code path.","Keep CI matrices limited to macOS/Linux so binaries aren't built for untested targets."],"tags":["platform","upgrade","unsupported-os"],"backgroundTag":"unsupported-platform","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}