mihomo-party-org/clash-party · error · Error
Unsupported platform "${plat}-${arch}"
Error message
Unsupported platform "${plat}-${arch}" What it means
installMihomoCore maps the current process platform/arch (e.g. 'darwin-arm64') through PLATFORM_MAP to a GitHub release filename. If no entry exists, it throws 'Unsupported platform "<plat>-<arch>"' before any download begins. This is a build-time-support guard, not a runtime failure — mihomo simply does not publish a binary for that combination.
Source
Thrown at src/main/utils/github.ts:184
}
/**
* 安装特定版本的 mihomo 核心
* @param version 版本号
*/
export async function installMihomoCore(version: string): Promise<void> {
try {
log.info(`Installing mihomo core version ${version}`)
const plat = platform()
const arch = process.arch
// 映射平台和架构到 GitHub Release 文件名
const key = `${plat}-${arch}`
const name = PLATFORM_MAP[key]
if (!name) {
throw new Error(`Unsupported platform "${plat}-${arch}"`)
}
const isWin = plat === 'win32'
const urlExt = isWin ? 'zip' : 'gz'
const downloadURL = `https://github.com/MetaCubeX/mihomo/releases/download/${version}/${name}-${version}.${urlExt}`
const coreDir = mihomoCoreDir()
const tempZip = join(coreDir, `temp-core.${urlExt}`)
const exeFile = `${name}${isWin ? '.exe' : ''}`
const targetFile = `mihomo-specific${isWin ? '.exe' : ''}`
const targetPath = join(coreDir, targetFile)
// 如果目标文件已存在,先停止核心
if (existsSync(targetPath)) {
log.debug('Stopping core before extracting new core file')
// 先停止核心
await stopCore(true)
}View on GitHub (pinned to 911e090537)
Solutions
- Run on a supported platform/arch listed in PLATFORM_MAP (darwin/linux/win32 on x64/arm64).
- If your platform genuinely has a mihomo release, update PLATFORM_MAP to add the key/filename.
- For unsupported OS, install the mihomo core manually and point the app at the existing binary instead of auto-install.
- Check process.platform/process.arch to confirm what key was constructed and compare against the map.
Example fix
// before: fails on linux-arm64 if map entry missing
throw new Error(`Unsupported platform "${plat}-${arch}"`)
// after: extend the map when upstream provides the asset
const PLATFORM_MAP = {
// ...existing entries,
'linux-arm64': 'mihomo-linux-arm64'
} Defensive patterns
Strategy: validation
Validate before calling
// verify the platform is supported before attempting install
const SUPPORTED = ['darwin-arm64', 'darwin-x64', 'linux-386', 'linux-amd64', 'linux-arm64', 'win32-386', 'win32-amd64']
const key = `${process.platform}-${process.arch}`
if (!SUPPORTED.includes(key)) {
throw new Error(`No mihomo core for ${key}; install the binary manually`)
} Type guard
function isSupportedPlatform(p: string, a: string): p is NodeJS.Platform & string {
const key = `${p}-${a}`
return ['darwin-arm64', 'darwin-x64', 'linux-amd64', 'linux-arm64', 'win32-amd64', 'win32-386'].includes(key)
} Try / catch
try {
await installSpecificMihomoCore(version)
} catch (e) {
if (String(e).includes('Unsupported platform')) {
// degrade: keep using an existing/manual core install
useManualCorePath()
} else {
throw e
}
} Prevention
- Check process.platform/process.arch against the supported matrix at app startup
- Document supported platforms and gate auto-install UI accordingly
- Provide a manual binary path option for exotic platforms
- Keep PLATFORM_MAP in sync with upstream mihomo release assets
When it happens
Trigger: installSpecificMihomoCore -> installMihomoCore running on a platform/arch pair missing from PLATFORM_MAP, such as freebsd, openbsd, win32-arm64, solaris, or an exotic Node arch value.
Common situations: Running the Electron app on Linux ARM boards (some supported, some not depending on map contents), FreeBSD desktop, or Windows-on-ARM; running the module in unit tests on an odd CI runner architecture.
Related errors
- Executable file not found in zip: ${exeFile}
- Failed to install core: ${error instanceof Error ? error.mes
- HTTP ${response.status} ${response.statusText}
AI-assisted analysis of mihomo-party-org/clash-party@911e090537 (2026-08-30).
Data as JSON: /api/errors/7fa49e099f881174.
Report an issue: GitHub.