BigPizzaV3/CodexPlusPlus · error
下载内容为空
Error message
下载内容为空
What it means
After successfully streaming an HTTP response in `download_limited`, the library rejects the result if zero bytes were received. An empty body cannot be a valid market manifest JSON or theme asset (image), so it is treated as a failed download rather than propagating empty data to JSON parsing or file writing.
Solutions
- Check the market server: the file at the URL is likely 0 bytes or missing — re-upload or restore the correct manifest/theme asset.
- Re-fetch the market index (clear the cached manifest in the state dir) to rule out a stale/bad cache cycle.
- Test the URL directly with `curl -v` to confirm the server returns a non-empty body; fix proxy/CDN configuration if it strips the body.
- If the asset URL in the manifest is wrong (pointing at an empty endpoint), correct the manifest and republish.
Defensive patterns
Strategy: retry
Try / catch
for attempt in 0..3 {
match download_limited(&client, &url, LIMIT).await {
Err(e) if e.to_string().contains("下载内容为空") => continue, // transient empty 200
other => { other?; break; }
}
} Prevention
- Verify market server files are non-zero bytes after upload (ci check on artifact size)
- Fix reverse-proxy/CDN configs that return empty 200s when origin files are missing
- Treat empty 204/200 responses as failed fetches and fall back to the cached manifest
- Monitor the market host for 0-byte files and missing-asset alerts
When it happens
Trigger: `fetch_market_manifest` or `install_market_theme_from_base` receiving an HTTP 2xx response with a zero-length body (e.g. a 204 No Content, an empty success page from a misconfigured proxy, or a server that lost its file but still returns 200).
Common situations: Reverse proxy or CDN returning empty 200 responses when the origin file is missing; uploading a 0-byte manifest/asset to the market host; captive portals or intercepting proxies returning empty success bodies; truncated uploads.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/98919524a3b9c0eb.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_market.rs:279
.error_for_status()
.with_context(|| format!("服务器返回错误状态:{url}"))?;
if response
.content_length()
.is_some_and(|size| size > limit as u64)
{
bail!("下载内容超过 {} 字节限制", limit);
}
let mut stream = response.bytes_stream();
let mut bytes = Vec::new();
while let Some(chunk) = stream.next().await {
let chunk = chunk.context("读取下载内容失败")?;
if bytes.len().saturating_add(chunk.len()) > limit {
bail!("下载内容超过 {} 字节限制", limit);
}
bytes.extend_from_slice(&chunk);
}
if bytes.is_empty() {
bail!("下载内容为空");
}
Ok(bytes)
}
fn cache_manifest(state_dir: &Path, manifest: &DreamSkinMarketManifest) -> anyhow::Result<()> {
let bytes = serde_json::to_vec_pretty(manifest)?;
crate::settings::atomic_write(&state_dir.join(MARKET_CACHE_FILE), &bytes)
}
fn read_cached_manifest(state_dir: &Path) -> anyhow::Result<DreamSkinMarketManifest> {
let path = state_dir.join(MARKET_CACHE_FILE);
let metadata = std::fs::metadata(&path)
.with_context(|| format!("主题市场缓存不存在:{}", path.display()))?;
if metadata.len() > MARKET_INDEX_LIMIT as u64 {
bail!("主题市场缓存超过大小限制");
}
let mut manifest: DreamSkinMarketManifest =
serde_json::from_slice(&std::fs::read(&path)?).context("主题市场缓存不是有效 JSON")?;View on GitHub (pinned to b1ed92e5e4)