BigPizzaV3/CodexPlusPlus · error

DreamSkin 主题版本与请求不一致

Error message

DreamSkin 主题版本与请求不一致

What it means

install_community_theme fetches a theme version's metadata from the community API and validates it. After schema validation, it checks that the returned metadata.id equals the requested version_id; if the server returns metadata for a different version, the install is aborted. This protects against CDN caches or API routing serving the wrong theme version.

Solutions

  1. Retry the install — a transient cache may resolve and return the correct version metadata.
  2. Verify the version_id was copied from the catalog/link exactly (not the parent theme id).
  3. Check the community API directly: GET /v1/themes/{version_id} and compare the returned id with your request.
  4. Clear/refresh any cache between client and API, or re-fetch the community catalog to get current valid version ids.

Example fix

// before: possibly stale id
install_community_theme(&state_dir, "old-version-id").await?;
// after: re-fetch catalog and use the fresh id
let catalog = fetch_community_catalog().await?;
let id = &catalog.items[0].latest_version_id;
install_community_theme(&state_dir, id).await?;
Defensive patterns

Strategy: validation

Validate before calling

// fetch metadata yourself and confirm the id before installing
let meta: DreamSkinCommunityTheme = http_get(format!("{ORIGIN}/v1/themes/{id}")).json().await?;
if meta.id != id { return Err("server returned a different version".into()); }

Try / catch

match install_community_theme(&state_dir, version_id).await {
    Err(e) if e.to_string().contains("版本与请求不一致") => {
        // re-fetch catalog, resolve fresh version id, retry once
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling install_community_theme(state_dir, version_id) where the GET /v1/themes/{version_id} response parses and passes validate_community_theme but carries an id field different from version_id — e.g. a stale/redirecting endpoint, alias resolution, or server bug returning another version's record.

Common situations: Server-side cache serving a different version record after an upload replaced a version id; a CDN edge with inconsistent data; passing a theme id instead of a version id to install_community_theme; community API routing bugs after re-publishing themes.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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

Appendix: source

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

pub async fn install_community_theme(
    state_dir: &Path,
    version_id: &str,
) -> anyhow::Result<DreamSkinThemeSummary> {
    validate_version_id(version_id)?;
    let client = community_http_client(Duration::from_secs(120))?;
    let metadata_url = format!("{COMMUNITY_API_ORIGIN}/v1/themes/{version_id}");
    let metadata_bytes = download_limited(
        &client,
        &metadata_url,
        METADATA_BYTES_LIMIT,
        "application/json",
    )
    .await?;
    let metadata: DreamSkinCommunityTheme =
        serde_json::from_slice(&metadata_bytes).context("DreamSkin 主题元数据不是有效 JSON")?;
    validate_community_theme(&metadata)?;
    if metadata.id != version_id {
        bail!("DreamSkin 主题版本与请求不一致");
    }
    if !metadata.apply_compatible {
        bail!("该主题是旧格式,只支持在线预览或手动下载");
    }

    let download_url = format!("{COMMUNITY_API_ORIGIN}/v1/themes/{version_id}/download");
    let package = download_limited(
        &client,
        &download_url,
        metadata.package_bytes,
        "application/zip",
    )
    .await?;
    if package.len() != metadata.package_bytes {
        bail!("DreamSkin 主题包实际大小与审核元数据不一致");
    }
    let actual_sha = format!("{:x}", Sha256::digest(&package));
    if !actual_sha.eq_ignore_ascii_case(&metadata.package_sha256) {

View on GitHub (pinned to b1ed92e5e4)