mihomo-party-org/clash-party · critical · Error

Failed to install core: ${error instanceof Error ? error.mes

Error message

Failed to install core: ${error instanceof Error ? error.message : String(error)}

What it means

The top-level catch of installMihomoCore: any failure during download, platform mapping, or extraction is logged and rethrown as 'Failed to install core: <inner message>'. It also cleans up temp-core.zip/temp-core.gz so failed downloads don't accumulate in the core directory. This is the error surface callers (installSpecificMihomoCore) actually see; the inner message identifies the stage that failed.

Source

Thrown at src/main/utils/github.ts:280

          if (existsSync(stagingPath)) rmSync(stagingPath)
        } catch {
          // ignore
        }
        throw error
      }
    }

    // 清理临时文件
    log.debug(`Cleaning up temporary file ${tempZip}`)
    cleanupTempFile(tempZip)

    log.info(`Successfully installed mihomo core version ${version}`)
  } catch (error) {
    // 解压失败时下载的压缩包会一直留在内核目录里,每次重试再落一份
    cleanupTempFile(join(mihomoCoreDir(), `temp-core.zip`))
    cleanupTempFile(join(mihomoCoreDir(), `temp-core.gz`))
    log.error('Failed to install mihomo core', error)
    throw new Error(
      `Failed to install core: ${error instanceof Error ? error.message : String(error)}`
    )
  }
}

View on GitHub (pinned to 911e090537)

Solutions

  1. Read the inner message after the colon to identify the stage: HTTP codes → network/mirror issue; 'Unsupported platform' → no release for your arch; 'Executable file not found' → archive layout change.
  2. Fix network/proxy access to github.com or configure a working mirror, then retry the install.
  3. Ensure the mihomo core directory is writable (check permissions/AV interference) and free disk space is available.
  4. Manually place the correct mihomo binary in the core directory as a workaround, then restart the app.
  5. Delete leftover temp-core.zip/temp-core.gz (the handler should already do this) and retry cleanly.

Example fix

// before: opaque retry loop
await installSpecificMihomoCore(version)
// after: handle the wrapped error distinctly
try {
  await installSpecificMihomoCore(version)
} catch (e) {
  const msg = String(e)
  if (msg.includes('Unsupported platform')) {
    console.error('No mihomo build for this OS/arch; install manually.')
  } else if (/HTTP \d+/.test(msg)) {
    await retryWithBackoff(() => installSpecificMihomoCore(version))
  } else {
    throw e
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

import { accessSync, constants } from 'fs'
// preflight: core dir writable and enough disk space before attempting install
try {
  accessSync(mihomoCoreDir(), constants.W_OK)
} catch {
  throw new Error(`Core directory not writable: ${mihomoCoreDir()}`)
}

Try / catch

try {
  await installSpecificMihomoCore(version)
} catch (e) {
  const inner = String(e).replace(/^Failed to install core: /, '')
  if (/HTTP \d+/.test(inner)) retryLater() // network/mirror stage
  else if (inner.includes('Unsupported platform')) showManualInstallGuide()
  else if (inner.includes('not found in zip')) reportUpstreamLayoutChange()
  else showGenericInstallError(inner)
}

Prevention

When it happens

Trigger: Any of: all download mirrors failing (errors 84), unsupported platform (85), exe missing from zip (86), gzip extraction failure, write-permission denial to mihomoCoreDir(), or disk full during extraction.

Common situations: Offline or firewalled machine with all mirrors blocked; read-only or permission-restricted core directory after an app update; interrupted download leaving a truncated archive; antivirus locking/deleting the extracted binary on Windows.

Related errors


AI-assisted analysis of mihomo-party-org/clash-party@911e090537 (2026-08-30). Data as JSON: /api/errors/16f6be910ce07121. Report an issue: GitHub.