{"record":{"id":"7fa49e099f881174","repo":"mihomo-party-org/clash-party","slug":"unsupported-platform-plat-arch","errorCode":null,"errorMessage":"Unsupported platform \"${plat}-${arch}\"","messagePattern":"Unsupported platform \"(.+?)-(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/utils/github.ts","lineNumber":184,"sourceCode":"}\n\n/**\n * 安装特定版本的 mihomo 核心\n * @param version 版本号\n */\nexport async function installMihomoCore(version: string): Promise<void> {\n  try {\n    log.info(`Installing mihomo core version ${version}`)\n\n    const plat = platform()\n    const arch = process.arch\n\n    // 映射平台和架构到 GitHub Release 文件名\n    const key = `${plat}-${arch}`\n    const name = PLATFORM_MAP[key]\n\n    if (!name) {\n      throw new Error(`Unsupported platform \"${plat}-${arch}\"`)\n    }\n\n    const isWin = plat === 'win32'\n    const urlExt = isWin ? 'zip' : 'gz'\n    const downloadURL = `https://github.com/MetaCubeX/mihomo/releases/download/${version}/${name}-${version}.${urlExt}`\n\n    const coreDir = mihomoCoreDir()\n    const tempZip = join(coreDir, `temp-core.${urlExt}`)\n    const exeFile = `${name}${isWin ? '.exe' : ''}`\n    const targetFile = `mihomo-specific${isWin ? '.exe' : ''}`\n    const targetPath = join(coreDir, targetFile)\n\n    // 如果目标文件已存在，先停止核心\n    if (existsSync(targetPath)) {\n      log.debug('Stopping core before extracting new core file')\n      // 先停止核心\n      await stopCore(true)\n    }","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/mihomo-party-org/clash-party/blob/911e090537acdf7c50bee1c3aebecc2ef119a8b5/src/main/utils/github.ts#L166-L202","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: fails on linux-arm64 if map entry missing\nthrow new Error(`Unsupported platform \"${plat}-${arch}\"`)\n// after: extend the map when upstream provides the asset\nconst PLATFORM_MAP = {\n  // ...existing entries,\n  'linux-arm64': 'mihomo-linux-arm64'\n}","handlingStrategy":"validation","validationCode":"// verify the platform is supported before attempting install\nconst SUPPORTED = ['darwin-arm64', 'darwin-x64', 'linux-386', 'linux-amd64', 'linux-arm64', 'win32-386', 'win32-amd64']\nconst key = `${process.platform}-${process.arch}`\nif (!SUPPORTED.includes(key)) {\n  throw new Error(`No mihomo core for ${key}; install the binary manually`)\n}","typeGuard":"function isSupportedPlatform(p: string, a: string): p is NodeJS.Platform & string {\n  const key = `${p}-${a}`\n  return ['darwin-arm64', 'darwin-x64', 'linux-amd64', 'linux-arm64', 'win32-amd64', 'win32-386'].includes(key)\n}","tryCatchPattern":"try {\n  await installSpecificMihomoCore(version)\n} catch (e) {\n  if (String(e).includes('Unsupported platform')) {\n    // degrade: keep using an existing/manual core install\n    useManualCorePath()\n  } else {\n    throw e\n  }\n}","preventionTips":["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"],"tags":["platform","unsupported-platform","installation","github-releases"],"backgroundTag":"unsupported-platform-arch","analyzedSha":"911e090537acdf7c50bee1c3aebecc2ef119a8b5","analyzedAt":"2026-08-30T13:00:49.174Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}