BigPizzaV3/CodexPlusPlus · error

没有可下载的 Release asset

Error message

没有可下载的 Release asset

What it means

perform_update downloads and launches the installer for a Release, but the download URL lives in the optional field Release.asset_url (Option<String>). It is None when the release payload contained no assets matching the current platform (select_update_asset found nothing). The function refuses to proceed and throws this error instead of downloading a URL-less release.

Solutions

  1. Check release.asset_url.is_some() before calling perform_update and surface a friendly 'no installer for this platform' message instead.
  2. Inspect the release payload's assets array to confirm an installer for the current platform (rank < 2 in platform_asset_rank) exists.
  3. Wait for/publish the platform installer asset, then retry the update check.
  4. If assets exist but weren't matched, fix the asset file naming so select_update_asset recognizes the platform suffix.
  5. Call check_for_update first and only enable the update button when update_available && asset_url.is_some().

Example fix

// before
let install = perform_update(&release, &dir).await?;
// after
if release.asset_url.is_none() {
    anyhow::bail!("当前平台没有可用的安装包,请手动下载");
}
let install = perform_update(&release, &dir).await?;
Defensive patterns

Strategy: type-guard

Validate before calling

fn can_perform_update(release: &Release) -> bool {
    release.asset_url.as_deref().map_or(false, |u| u.starts_with("http"))
}

Type guard

fn download_url(release: &Release) -> Option<&str> {
    release.asset_url.as_deref()
}

Try / catch

match perform_update(&release, &dir).await {
    Ok(install) => install,
    Err(e) if e.to_string().contains("没有可下载的 Release asset") => {
        eprintln!("no installer for this platform; open {} manually", release.url);
        // degrade gracefully: offer release.url in browser
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling perform_update with a Release produced from a payload whose 'assets' array was empty, missing, or contained only installers for other platforms (e.g. only .dmg on a Windows host), or whose asset entries lacked name/browser_download_url keys.

Common situations: The GitHub release was published without platform binaries attached; the latest.json manifest lists assets under a different key naming convention; cross-platform update check where the remote release lags behind and the local OS's asset was not yet uploaded; corporate mirror stripping asset metadata.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/f65348695bf10328. Report an issue: GitHub.

Appendix: source

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

    let update_available = is_newer_version(&release.version, current_version)?;
    Ok(UpdateCheck {
        current_version: current_version.to_string(),
        latest_version: Some(release.version),
        release_summary: release.body,
        asset_name: release.asset_name,
        asset_url: release.asset_url,
        update_available,
    })
}

pub async fn perform_update(
    release: &Release,
    download_dir: &Path,
) -> anyhow::Result<UpdateInstall> {
    let url = release
        .asset_url
        .as_ref()
        .ok_or_else(|| anyhow::anyhow!("没有可下载的 Release asset"))?;
    let _ = crate::diagnostic_log::append_diagnostic_log(
        "update.perform.start",
        json!({
            "version": release.version,
            "assetName": release.asset_name,
            "assetUrl": url,
            "downloadTimeoutSeconds": UPDATE_DOWNLOAD_TIMEOUT.as_secs()
        }),
    );
    let response = match update_http_client()?.get(url).send().await {
        Ok(response) => response,
        Err(error) => {
            let _ = crate::diagnostic_log::append_diagnostic_log(
                "update.download.failed",
                json!({ "version": release.version, "assetName": release.asset_name, "error": error.to_string() }),
            );
            return Err(anyhow::anyhow!("下载安装包失败:{error}"));
        }

View on GitHub (pinned to b1ed92e5e4)