BigPizzaV3/CodexPlusPlus · error
读取安装包失败:
Error message
读取安装包失败:{error} What it means
Once a 2xx response is confirmed, perform_update buffers the full body with response.bytes().await. If reading the body fails mid-stream (connection reset, timeout while streaming, TLS truncation), the failure is logged as 'update.download.body_failed' and rethrown as 读取安装包失败:{error} with the reqwest error text embedded.
Solutions
- Simply retry perform_update — body read failures are usually transient network interruptions.
- Check link stability / switch networks before retrying large downloads.
- If timeouts recur on slow links, download the installer manually via a browser or a resumable downloader (curl -C -).
- Verify the downloaded file size afterwards if you implement your own retry, to guard against truncation.
- Report persistent truncation against the specific mirror/proxy terminating the stream.
Example fix
// before
let install = perform_update(&release, &dir).await?;
// after
let install = match perform_update(&release, &dir).await {
Ok(i) => i,
Err(e) if e.to_string().contains("读取安装包失败") => {
tokio::time::sleep(Duration::from_secs(5)).await;
perform_update(&release, &dir).await? // retry once on transient body failure
}
Err(e) => return Err(e),
}; Defensive patterns
Strategy: retry
Validate before calling
// check expected size if the manifest exposes one, or HEAD first
let expected = reqwest::Client::new().head(url).send().await?
.headers().get(reqwest::header::CONTENT_LENGTH)
.and_then(|v| v.to_str().ok()).and_then(|s| s.parse::<u64>().ok()); Try / catch
match perform_update(&release, &dir).await {
Err(e) if e.to_string().contains("读取安装包失败") => {
// truncated/mid-stream failure: short backoff, then retry
tokio::time::sleep(Duration::from_secs(3)).await;
perform_update(&release, &dir).await
}
other => other,
} Prevention
- Prefer stable networks for large installer downloads; abort-and-retry is safe.
- Note the 600s download timeout: on very slow links, download manually instead.
- Avoid proxies that kill idle/long connections during large transfers.
- After any manual download, verify the file size matches the asset's Content-Length.
When it happens
Trigger: Calling perform_update when the connection drops while streaming a large installer; the 600s UPDATE_DOWNLOAD_TIMEOUT elapses on a slow link; a proxy terminates the response early; the CDN aborts the transfer.
Common situations: Downloading a multi-hundred-MB installer over flaky Wi-Fi or mobile hotspot; corporate proxy with idle-connection kill; slow mirror truncating large files.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/81e9439efd20663d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/update.rs:242
};
let response = match response.error_for_status() {
Ok(response) => response,
Err(error) => {
let _ = crate::diagnostic_log::append_diagnostic_log(
"update.download.bad_status",
json!({ "version": release.version, "assetName": release.asset_name, "error": error.to_string() }),
);
return Err(anyhow::anyhow!("下载安装包失败:{error}"));
}
};
let bytes = match response.bytes().await {
Ok(bytes) => bytes,
Err(error) => {
let _ = crate::diagnostic_log::append_diagnostic_log(
"update.download.body_failed",
json!({ "version": release.version, "assetName": release.asset_name, "error": error.to_string() }),
);
return Err(anyhow::anyhow!("读取安装包失败:{error}"));
}
};
let _ = crate::diagnostic_log::append_diagnostic_log(
"update.download.completed",
json!({
"version": release.version,
"assetName": release.asset_name,
"bytes": bytes.len()
}),
);
let installer_path = match download_asset_to(release, &bytes, download_dir) {
Ok(path) => path,
Err(error) => {
let _ = crate::diagnostic_log::append_diagnostic_log(
"update.write.failed",
json!({
"version": release.version,
"assetName": release.asset_name,View on GitHub (pinned to b1ed92e5e4)