{"record":{"id":"f65348695bf10328","repo":"BigPizzaV3/CodexPlusPlus","slug":"release-asset","errorCode":null,"errorMessage":"没有可下载的 Release asset","messagePattern":"没有可下载的 Release asset","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/update.rs","lineNumber":205,"sourceCode":"    let update_available = is_newer_version(&release.version, current_version)?;\n    Ok(UpdateCheck {\n        current_version: current_version.to_string(),\n        latest_version: Some(release.version),\n        release_summary: release.body,\n        asset_name: release.asset_name,\n        asset_url: release.asset_url,\n        update_available,\n    })\n}\n\npub async fn perform_update(\n    release: &Release,\n    download_dir: &Path,\n) -> anyhow::Result<UpdateInstall> {\n    let url = release\n        .asset_url\n        .as_ref()\n        .ok_or_else(|| anyhow::anyhow!(\"没有可下载的 Release asset\"))?;\n    let _ = crate::diagnostic_log::append_diagnostic_log(\n        \"update.perform.start\",\n        json!({\n            \"version\": release.version,\n            \"assetName\": release.asset_name,\n            \"assetUrl\": url,\n            \"downloadTimeoutSeconds\": UPDATE_DOWNLOAD_TIMEOUT.as_secs()\n        }),\n    );\n    let response = match update_http_client()?.get(url).send().await {\n        Ok(response) => response,\n        Err(error) => {\n            let _ = crate::diagnostic_log::append_diagnostic_log(\n                \"update.download.failed\",\n                json!({ \"version\": release.version, \"assetName\": release.asset_name, \"error\": error.to_string() }),\n            );\n            return Err(anyhow::anyhow!(\"下载安装包失败：{error}\"));\n        }","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/update.rs#L187-L223","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check release.asset_url.is_some() before calling perform_update and surface a friendly 'no installer for this platform' message instead.","Inspect the release payload's assets array to confirm an installer for the current platform (rank < 2 in platform_asset_rank) exists.","Wait for/publish the platform installer asset, then retry the update check.","If assets exist but weren't matched, fix the asset file naming so select_update_asset recognizes the platform suffix.","Call check_for_update first and only enable the update button when update_available && asset_url.is_some()."],"exampleFix":"// before\nlet install = perform_update(&release, &dir).await?;\n// after\nif release.asset_url.is_none() {\n    anyhow::bail!(\"当前平台没有可用的安装包，请手动下载\");\n}\nlet install = perform_update(&release, &dir).await?;","handlingStrategy":"type-guard","validationCode":"fn can_perform_update(release: &Release) -> bool {\n    release.asset_url.as_deref().map_or(false, |u| u.starts_with(\"http\"))\n}","typeGuard":"fn download_url(release: &Release) -> Option<&str> {\n    release.asset_url.as_deref()\n}","tryCatchPattern":"match perform_update(&release, &dir).await {\n    Ok(install) => install,\n    Err(e) if e.to_string().contains(\"没有可下载的 Release asset\") => {\n        eprintln!(\"no installer for this platform; open {} manually\", release.url);\n        // degrade gracefully: offer release.url in browser\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Gate the update action on check_for_update returning asset_url: Some(_).","Ensure every published release attaches an installer for every supported platform.","Keep asset file names platform-recognizable so select_update_asset matches them.","Cover the None-asset case in UI flows with a manual-download fallback link."],"tags":["update","release-assets","missing-asset","platform"],"backgroundTag":"resource-not-found","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}