BigPizzaV3/CodexPlusPlus · error · anyhow::Error

当前平台不支持启动安装包

Error message

当前平台不支持启动安装包

What it means

launch_installer implements only Windows (spawn the installer) and macOS (open the DMG). On every other platform — Linux, BSD — it unconditionally bails with "当前平台不支持启动安装包"; there is no code path that could succeed, and the path argument is deliberately discarded (let _ = path).

Source

Thrown at crates/codex-plus-core/src/update.rs:433

            .creation_flags(crate::windows_integration::CREATE_NO_WINDOW)
            .spawn()
            .map(|_| ())
            .map_err(|error| anyhow::anyhow!("启动安装包失败:{error}"))
    }

    #[cfg(target_os = "macos")]
    {
        std::process::Command::new("open")
            .arg(path)
            .spawn()
            .map(|_| ())
            .map_err(|error| anyhow::anyhow!("打开 DMG 失败:{error}"))
    }

    #[cfg(all(not(windows), not(target_os = "macos")))]
    {
        let _ = path;
        anyhow::bail!("当前平台不支持启动安装包")
    }
}

View on GitHub (pinned to 1f431ae49b)

Solutions

  1. Gate the UI/action behind an OS check so the option never appears on unsupported platforms
  2. Download the asset manually and install by hand on Linux
  3. If you maintain the app, implement a Linux path (e.g. open the containing folder or run an AppImage) instead of bailing
  4. In tests, cfg-skip the launch step on non-Windows/macOS platforms

Example fix

// before
launch_installer(&install.installer_path)?;

// after
#[cfg(any(windows, target_os = "macos"))]
launch_installer(&install.installer_path)?;
#[cfg(all(not(windows), not(target_os = "macos")))]
{
    let _ = &install.installer_path;
    // open the download folder instead of failing
}
Defensive patterns

Strategy: validation

Validate before calling

if !cfg!(any(windows, target_os = "macos")) {
    anyhow::bail!("installer launch is unsupported on this OS; install manually");
}
launch_installer(&install.installer_path)?;

Prevention

When it happens

Trigger: Compiling/running the manager on Linux and invoking the install-update flow that ends in launch_installer; e2e tests calling launch_installer on Linux CI runners.

Common situations: Community Linux builds of a primarily Windows/macOS app; automation not gated by cfg attributes; users on unsupported platforms clicking an install button that should have been hidden.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@1f431ae49b (2026-08-16). Data as JSON: /api/errors/0da8cd8bb15083b1. Report an issue: GitHub.