BigPizzaV3/CodexPlusPlus · error

主题市场清单超过 项限制

Error message

主题市场清单超过 {} 项限制

What it means

validate_manifest caps the number of themes a market manifest may contain at MARKET_THEME_COUNT_LIMIT. Oversized manifests are rejected to bound download/render cost and prevent abuse from a hostile market source.

Solutions

  1. Split the market catalog into multiple manifests, each within the theme-count limit
  2. Have the market publisher prune deprecated/unlisted themes so the count fits the limit
  3. If you operate a mirror, filter the manifest to the themes you intend to serve before publishing
  4. Check whether you fetched the wrong (archive/index) URL instead of the curated manifest

Example fix

// before
{ "schemaVersion": 1, "themes": [ /* 500 entries > limit */ ] }
// after — paginate/split
{ "schemaVersion": 1, "themes": [ /* <= MARKET_THEME_COUNT_LIMIT entries */ ] }
Defensive patterns

Strategy: validation

Validate before calling

if manifest.themes.len() > MARKET_THEME_COUNT_LIMIT {
    return Err(anyhow::anyhow!("manifest has {} themes, limit is {}", manifest.themes.len(), MARKET_THEME_COUNT_LIMIT));
}

Try / catch

match fetch_market_manifest(url).await {
    Ok(m) => use_manifest(m),
    Err(e) if e.to_string().contains("项限制") => {
        eprintln!("market manifest too large — use a curated/filtered source");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: fetch_market_manifest or read_cached_manifest receives a manifest whose themes array exceeds MARKET_THEME_COUNT_LIMIT — usually a rogue/misconfigured market source, an aggregated manifest merging many publishers, or a fixture used in tests.

Common situations: A self-hosted market accidentally publishes its full theme archive index; someone concatenates multiple manifests; a malicious mirror inflates the list to stress the client.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

        theme.installed = local_theme.is_file();
        theme.installed_version = if theme.installed {
            records.themes.get(&theme.id).cloned().unwrap_or_default()
        } else {
            String::new()
        };
        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),

View on GitHub (pinned to b1ed92e5e4)