BigPizzaV3/CodexPlusPlus · error

DreamSkin 服务返回了不支持的内容类型:

Error message

DreamSkin 服务返回了不支持的内容类型:{content_type}

What it means

download_limited validates the response's Content-Type header (ignoring parameters like charset) against the expected type for the request (catalog JSON vs. package ZIP). A mismatch — including a missing/empty Content-Type — is rejected to avoid parsing a wrong or hostile body.

Solutions

  1. Check the returned content type in the message and verify you are calling the correct endpoint (catalog URL vs. package URL).
  2. Inspect for a proxy/captive portal injecting HTML responses and fix network routing.
  3. Fix the server/CDN MIME configuration so it serves application/json or application/zip as expected.
  4. Retry later if it is a transient server-side misconfiguration; report to the service operator.

Example fix

// before
let url = format!("{base}/themes/{id}/download"); // wrong endpoint, returns JSON not zip
// after
let url = format!("{base}/community/packages/{version_id}.zip");
Defensive patterns

Strategy: validation

Validate before calling

// Rust
let ct = resp.headers().get(reqwest::header::CONTENT_TYPE)
    .and_then(|v| v.to_str().ok())
    .and_then(|v| v.split(';').next())
    .map(str::trim)
    .unwrap_or_default();
let acceptable = ct == expected_content_type;

Try / catch

// Rust
Err(e) if e.to_string().contains("内容类型") => {
    eprintln!("服务返回了非预期内容(可能被代理拦截),请检查网络后重试");
}

Prevention

When it happens

Trigger: fetch_community_catalog or install_community_theme receiving a response whose base content type is not exactly the expected value, e.g. text/html from an error/interstitial page, application/octet-stream instead of application/zip, or a missing header yielding an empty string in the message.

Common situations: Captive portal or proxy returning an HTML login page; CDN misconfiguration serving the wrong MIME type; server upgrade changing content types; request sent to the wrong endpoint.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_community.rs:455

) -> anyhow::Result<Vec<u8>> {
    let response = client
        .get(url)
        .header(reqwest::header::ACCEPT, expected_content_type)
        .send()
        .await
        .with_context(|| format!("请求失败:{url}"))?;
    if !response.status().is_success() {
        bail!("DreamSkin 服务返回 HTTP {}", response.status());
    }
    let content_type = response
        .headers()
        .get(reqwest::header::CONTENT_TYPE)
        .and_then(|value| value.to_str().ok())
        .and_then(|value| value.split(';').next())
        .map(str::trim)
        .unwrap_or_default();
    if content_type != expected_content_type {
        bail!("DreamSkin 服务返回了不支持的内容类型:{content_type}");
    }
    if response
        .content_length()
        .is_some_and(|length| length == 0 || length > limit as u64)
    {
        bail!("DreamSkin 响应超过大小限制");
    }
    let mut bytes = Vec::new();
    let mut stream = response.bytes_stream();
    while let Some(chunk) = stream.next().await {
        let chunk = chunk?;
        if bytes.len().saturating_add(chunk.len()) > limit {
            bail!("DreamSkin 响应超过大小限制");
        }
        bytes.extend_from_slice(&chunk);
    }
    if bytes.is_empty() {
        bail!("DreamSkin 服务返回空响应");

View on GitHub (pinned to b1ed92e5e4)