BigPizzaV3/CodexPlusPlus · error

市场主题 的描述或标签数量超过限制

Error message

市场主题 {} 的描述或标签数量超过限制

What it means

validate_market_theme enforces size limits on the free-form description (≤500 chars) and the number of tags (≤12). Exceeding either bound aborts manifest validation or installation so market payloads stay bounded.

Solutions

  1. Trim the description to ≤500 characters (move long text to the theme's source page)
  2. Reduce the tags array to at most 12 of the most relevant tags
  3. Regenerate the manifest with a publishing script that clamps these fields

Example fix

// before
{ "id": "cool-theme", "description": "<2000 chars>", "tags": ["a","b", ... 20 tags] }
// after
{ "id": "cool-theme", "description": "Short summary (<500 chars)", "tags": ["dark","minimal"] }
Defensive patterns

Strategy: validation

Validate before calling

if theme.description.len() > 500 {
    return Err(anyhow::anyhow!("description too long ({} > 500)", theme.description.len()));
}
if theme.tags.len() > 12 {
    return Err(anyhow::anyhow!("too many tags ({})", theme.tags.len()));
}

Try / catch

match install_market_theme(state_dir, &theme).await {
    Ok(s) => println!("installed {}", s.id),
    Err(e) if e.to_string().contains("描述或标签") => {
        eprintln!("theme {} exceeds description/tag limits — trim before publishing", theme.id);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: install_market_theme_from_base or validate_manifest encounters a theme whose description length exceeds 500 characters or whose tags array has more than 12 entries — commonly from auto-generated descriptions or publishers tagging exhaustively.

Common situations: A publisher pastes a full README as the description; a manifest generator adds every keyword as a tag; migrated legacy catalog data with unbounded fields.

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/4fa5cf90a01789e7. Report an issue: GitHub.

Appendix: source

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

    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);
        }
    }
    if theme.description.len() > 500 || theme.tags.len() > 12 {
        bail!("市场主题 {} 的描述或标签数量超过限制", theme.id);
    }
    if theme
        .tags
        .iter()
        .any(|tag| tag.trim().is_empty() || tag.len() > 32)
    {
        bail!("市场主题 {} 包含无效标签", theme.id);
    }
    let source = reqwest::Url::parse(&theme.source_url)
        .with_context(|| format!("市场主题 {} 的来源地址无效", theme.id))?;
    if !matches!(source.scheme(), "http" | "https") {
        bail!("市场主题 {} 的来源地址协议无效", theme.id);
    }
    for path in [&theme.theme, &theme.image, &theme.preview] {
        validate_market_path(path)?;
    }
    validate_sha256(&theme.theme_sha256)?;
    validate_sha256(&theme.image_sha256)?;

View on GitHub (pinned to b1ed92e5e4)