{"record":{"id":"af7e5dcae9e769c3","repo":"libnyanpasu/clash-nyanpasu","slug":"unsupported-platform","errorCode":null,"errorMessage":"unsupported platform","messagePattern":"unsupported platform","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/tauri/src/core/updater/shared.rs","lineNumber":15,"sourceCode":"pub(super) fn get_arch() -> anyhow::Result<&'static str> {\n    let env = {\n        let arch = std::env::consts::ARCH;\n        let os = std::env::consts::OS;\n        (arch, os)\n    };\n\n    match env {\n        (\"x86_64\", \"macos\") => Ok(\"darwin-x64\"),\n        (\"x86_64\", \"linux\") => Ok(\"linux-amd64\"),\n        (\"x86_64\", \"windows\") => Ok(\"windows-x86_64\"),\n        (\"aarch64\", \"macos\") => Ok(\"darwin-arm64\"),\n        (\"aarch64\", \"linux\") => Ok(\"linux-aarch64\"),\n        (\"aarch64\", \"windows\") => Ok(\"windows-arm64\"),\n        _ => anyhow::bail!(\"unsupported platform\"),\n    }\n}\n\npub(super) enum CoreTypeMeta {\n    ClashPremium(String),\n    Mihomo(String),\n    MihomoAlpha,\n    ClashRs(String),\n    ClashRsAlpha,\n    Meow(String),\n}\n\npub(super) fn get_download_path(core_type: CoreTypeMeta, artifact: &str) -> String {\n    match core_type {\n        CoreTypeMeta::Mihomo(tag) => {\n            format!(\"MetaCubeX/mihomo/releases/download/{tag}/{artifact}\")\n        }\n        CoreTypeMeta::MihomoAlpha => {","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/tauri/src/core/updater/shared.rs#L1-L33","documentation":"get_arch maps a (arch, os) tuple to the updater's core-download platform triple (e.g. \"darwin-x64\"). If the compile-target architecture/OS combination is not one of the six explicitly supported pairs, the function bails with \"unsupported platform\". This guards the updater against constructing download URLs for binaries that are never published.","triggerScenarios":"Calling get_matches (which calls get_arch) on a build targeting an arch/os pair outside {x86_64,aarch64} x {macos,windows,linux} — e.g. compiling for x86 (32-bit) Windows, armv7 Linux, riscv64, or freebsd.","commonSituations":"Building the app for an unusual target triple (cross-compilation experiments, community distro packages for 32-bit or niche arches); running the updater path on a platform the project does not publish core binaries for.","solutions":["Build/target only supported platforms: x86_64 or aarch64 on macOS, Windows, or Linux.","If you genuinely need a new target, add a match arm mapping it to the correct updater platform string (and ensure upstream publishes cores for it).","As a workaround, disable the updater feature on unsupported targets so the download path is never reached."],"exampleFix":"// before\n_ => anyhow::bail!(\"unsupported platform\"),\n// after\n(\"riscv64\", \"linux\") => Ok(\"linux-riscv64\"), // requires upstream core binaries\n_ => anyhow::bail!(\"unsupported platform\"),","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[(&str, &str)] = &[(\"x86_64\", \"macos\"), (\"x86_64\", \"linux\"), (\"x86_64\", \"windows\"), (\"aarch64\", \"macos\"), (\"aarch64\", \"linux\"), (\"aarch64\", \"windows\")];\nfn is_supported_platform() -> bool {\n    let arch = std::env::consts::ARCH;\n    let os = std::env::consts::OS;\n    SUPPORTED.contains(&(arch, os))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate updater features behind a cfg/target check at compile time (#[cfg(target_arch = \"x86_64\")] etc.).","Only cross-compile to the six published platform triples.","Add a CI job that fails if the updater path is compiled for an unmapped target."],"tags":["updater","platform","compilation-target"],"backgroundTag":"unsupported-platform","analyzedSha":"f7dbce2997c633e484f54788035e770b3ee99773","analyzedAt":"2026-09-08T01:24:59.197Z","contentChangedAt":"2026-09-08T01:24:59.197Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}