BigPizzaV3/CodexPlusPlus · error

主题市场清单包含重复 ID:

Error message

主题市场清单包含重复 ID:{}

What it means

validate_manifest enforces unique theme IDs across the manifest. Each theme's id is inserted into a HashSet; a duplicate aborts validation so downstream lookup/install flows cannot be ambiguous about which record to use.

Solutions

  1. Deduplicate the manifest themes array, keeping a single entry per id (usually the newest version)
  2. Ask the market publisher to fix their generation script to key entries by id
  3. If merging manifests yourself, merge by id instead of concatenating arrays

Example fix

// before
themes: [ {id: "cool-theme", version: "1.0"}, {id: "cool-theme", version: "1.1"} ]
// after
themes: [ {id: "cool-theme", version: "1.1"} ]
Defensive patterns

Strategy: validation

Validate before calling

let ids: std::collections::HashSet<&str> = manifest.themes.iter().map(|t| t.id.as_str()).collect();
if ids.len() != manifest.themes.len() {
    return Err(anyhow::anyhow!("manifest contains duplicate theme ids"));
}

Try / catch

match fetch_market_manifest(url).await {
    Ok(m) => use_manifest(m),
    Err(e) if e.to_string().contains("重复 ID") => {
        eprintln!("market manifest has duplicate ids — notify the publisher");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: fetch_market_manifest or read_cached_manifest processes a manifest where two themes share the same id — e.g. a publisher listed the same theme twice with different versions, or a merge of two manifests duplicated entries.

Common situations: Hand-edited market manifests; automated publishers re-emitting entries without deduplication; a mirror concatenating upstream and patched manifests.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_market.rs:196

        theme.update_available = theme.installed
            && !theme.installed_version.is_empty()
            && theme.installed_version != theme.version;
    }
    manifest
}

fn validate_manifest(manifest: &mut DreamSkinMarketManifest) -> anyhow::Result<()> {
    if manifest.schema_version != 1 {
        bail!("不支持的主题市场清单版本");
    }
    if manifest.themes.len() > MARKET_THEME_COUNT_LIMIT {
        bail!("主题市场清单超过 {} 项限制", MARKET_THEME_COUNT_LIMIT);
    }
    let mut ids = HashSet::new();
    for theme in &mut manifest.themes {
        validate_market_theme(theme)?;
        if !ids.insert(theme.id.clone()) {
            bail!("主题市场清单包含重复 ID:{}", theme.id);
        }
        theme.preview_url = market_asset_url(DEFAULT_MARKET_RAW_BASE_URL, &theme.preview)?;
    }
    Ok(())
}

fn validate_market_theme(theme: &DreamSkinMarketTheme) -> anyhow::Result<()> {
    if !valid_theme_id(&theme.id) {
        bail!("主题市场包含无效 ID:{}", theme.id);
    }
    for (label, value, limit) in [
        ("名称", theme.name.as_str(), 100usize),
        ("版本", theme.version.as_str(), 40usize),
        ("作者", theme.author.as_str(), 100usize),
        ("许可证", theme.license.as_str(), 100usize),
    ] {
        if value.trim().is_empty() || value.len() > limit {
            bail!("市场主题 {} 的{}无效", theme.id, label);

View on GitHub (pinned to b1ed92e5e4)