{"record":{"id":"11fa83886b0370d4","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-11fa83","errorCode":null,"errorMessage":"下载安装包失败：{error}","messagePattern":"下载安装包失败：(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/update.rs","lineNumber":222,"sourceCode":"        .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        }\n    };\n    let response = match response.error_for_status() {\n        Ok(response) => response,\n        Err(error) => {\n            let _ = crate::diagnostic_log::append_diagnostic_log(\n                \"update.download.bad_status\",\n                json!({ \"version\": release.version, \"assetName\": release.asset_name, \"error\": error.to_string() }),\n            );\n            return Err(anyhow::anyhow!(\"下载安装包失败：{error}\"));\n        }\n    };\n    let bytes = match response.bytes().await {\n        Ok(bytes) => bytes,\n        Err(error) => {\n            let _ = crate::diagnostic_log::append_diagnostic_log(\n                \"update.download.body_failed\",\n                json!({ \"version\": release.version, \"assetName\": release.asset_name, \"error\": error.to_string() }),","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/update.rs#L204-L240","documentation":"perform_update sends a GET request for the release asset via reqwest; if the request itself fails at the transport layer (DNS, connect, TLS, timeout), the error is logged to the diagnostic log as 'update.download.failed' and rethrown wrapped as 下载安装包失败：{error}. The original reqwest error text is embedded in the message.","triggerScenarios":"Calling perform_update when: the machine is offline or behind a captive portal; the asset URL host is unreachable or DNS fails; the 15s connect timeout or 600s download timeout elapses; a proxy/firewall blocks the connection; TLS handshake fails against a corporate MITM proxy.","commonSituations":"Updating from a restricted corporate network without proxy config; GitHub asset CDN (objects.githubusercontent.com) blocked in the region; transient network drop mid-update; VPN required but not connected.","solutions":["Read the embedded reqwest error after the colon to identify the root cause (dns error, connection refused, timeout).","Verify basic connectivity to the asset host (curl -I the asset_url) and any required proxy settings.","Retry perform_update after confirming the network is stable — transient failures are common.","Set HTTPS_PROXY/HTTP_PROXY env vars if updates must traverse a corporate proxy.","If timeouts recur, check firewall rules for the download host or use a mirror URL for the asset."],"exampleFix":"// before\nlet install = perform_update(&release, &dir).await?;\n// after\nmatch perform_update(&release, &dir).await {\n    Ok(install) => ...,\n    Err(e) if e.to_string().contains(\"下载安装包失败\") => {\n        log::warn!(\"update download failed, check network/proxy: {e}\");\n        // retry or prompt user to download manually\n    }\n    Err(e) => return Err(e),\n}","handlingStrategy":"retry","validationCode":"// pre-check reachability of the asset URL\nlet head = reqwest::Client::new().head(url).send().await?;\nanyhow::ensure!(head.status().is_success(), \"asset unreachable: {}\", head.status());","typeGuard":null,"tryCatchPattern":"match perform_update(&release, &dir).await {\n    Err(e) if e.to_string().contains(\"下载安装包失败\") => {\n        // network-layer failure: backoff and retry\n        tokio::time::sleep(Duration::from_secs(5)).await;\n        perform_update(&release, &dir).await\n    }\n    other => other,\n}","preventionTips":["Configure HTTPS_PROXY/HTTP_PROXY in restricted networks before updating.","Distinguish transport errors (this one) from HTTP status errors (bad_status) when retrying.","Retry with exponential backoff; these failures are frequently transient.","Verify DNS/firewall access to the asset CDN host in corporate environments."],"tags":["network","download","reqwest","update"],"backgroundTag":"http-request-failed","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"}