libnyanpasu/clash-nyanpasu · error
unsupported platform
Error message
unsupported platform
What it means
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.
Source
Thrown at backend/tauri/src/core/updater/shared.rs:15
pub(super) fn get_arch() -> anyhow::Result<&'static str> {
let env = {
let arch = std::env::consts::ARCH;
let os = std::env::consts::OS;
(arch, os)
};
match env {
("x86_64", "macos") => Ok("darwin-x64"),
("x86_64", "linux") => Ok("linux-amd64"),
("x86_64", "windows") => Ok("windows-x86_64"),
("aarch64", "macos") => Ok("darwin-arm64"),
("aarch64", "linux") => Ok("linux-aarch64"),
("aarch64", "windows") => Ok("windows-arm64"),
_ => anyhow::bail!("unsupported platform"),
}
}
pub(super) enum CoreTypeMeta {
ClashPremium(String),
Mihomo(String),
MihomoAlpha,
ClashRs(String),
ClashRsAlpha,
Meow(String),
}
pub(super) fn get_download_path(core_type: CoreTypeMeta, artifact: &str) -> String {
match core_type {
CoreTypeMeta::Mihomo(tag) => {
format!("MetaCubeX/mihomo/releases/download/{tag}/{artifact}")
}
CoreTypeMeta::MihomoAlpha => {View on GitHub (pinned to f7dbce2997)
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.
Example fix
// before
_ => anyhow::bail!("unsupported platform"),
// after
("riscv64", "linux") => Ok("linux-riscv64"), // requires upstream core binaries
_ => anyhow::bail!("unsupported platform"), Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED: &[(&str, &str)] = &[("x86_64", "macos"), ("x86_64", "linux"), ("x86_64", "windows"), ("aarch64", "macos"), ("aarch64", "linux"), ("aarch64", "windows")];
fn is_supported_platform() -> bool {
let arch = std::env::consts::ARCH;
let os = std::env::consts::OS;
SUPPORTED.contains(&(arch, os))
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Failed to update
- flushing the system DNS cache is not supported on this platf
- PAC proxy is not supported on this platform
- Direct proxy is not supported on this platform
- failed to get core dir
AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08).
Data as JSON: /api/errors/af7e5dcae9e769c3.
Report an issue: GitHub.