BigPizzaV3/CodexPlusPlus · error

市场主题 包含无效标签

Error message

市场主题 {} 包含无效标签

What it means

validate_market_theme enforces per-field length and non-empty rules for name/version/author/license, then description ≤500 bytes and ≤12 tags. This specific bail fires when any entry in theme.tags is empty after trimming or longer than 32 bytes — a generic validation sentinel protecting market metadata from junk or oversized labels.

Solutions

  1. Remove empty/whitespace tags and shorten any tag longer than 32 characters in the manifest
  2. Fix the manifest generation script to filter blank tags and cap tag length
  3. Republish the manifest and retry the install

Example fix

// before
{ "id": "cool-theme", "tags": ["dark", "", "an-extremely-long-tag-description-over-32-chars"] }
// after
{ "id": "cool-theme", "tags": ["dark", "minimal"] }
Defensive patterns

Strategy: validation

Validate before calling

fn tags_ok(tags: &[String]) -> bool {
    tags.iter().all(|t| !t.trim().is_empty() && t.len() <= 32)
}
if !tags_ok(&theme.tags) {
    return Err(anyhow::anyhow!("theme {} has invalid tags", theme.id));
}

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 {} has empty or over-length tags — clean the manifest", theme.id);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: install_market_theme_from_base or validate_manifest processes a theme whose tags array contains "", " ", or a tag exceeding 32 chars — e.g. a generator that appends empty strings or splits a long phrase with a non-standard separator.

Common situations: Hand-edited manifests with a trailing empty tag; a publishing script joining keywords into one overlong tag; localization pipelines inserting blank tags for untranslated entries.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

    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)?;
    Ok(())
}

fn market_http_client() -> anyhow::Result<reqwest::Client> {
    Ok(reqwest::Client::builder()
        .user_agent(format!(
            "CodexPlusPlus-Themes/{}",

View on GitHub (pinned to b1ed92e5e4)