BigPizzaV3/CodexPlusPlus · error

市场主题 的 无效

Error message

市场主题 {} 的{}无效

What it means

validate_market_theme checks four textual fields — name (名称), version (版本), author (作者), license (许可证) — for being blank or exceeding their per-field length limits (100/40/100/100 chars). Any violation aborts manifest validation or theme installation with a message naming the offending theme id and field label.

Solutions

  1. Shorten the offending field in the manifest to within its limit (name/author/license ≤100 chars, version ≤40) and remove leading/trailing whitespace
  2. Fill in any empty field with a meaningful value before publishing
  3. If a version string is too long, use a short semver tag instead of a full commit SHA

Example fix

// before
{ "id": "cool-theme", "name": "", "version": "a1b2c3...full-64-char-sha", ... }
// after
{ "id": "cool-theme", "name": "Cool Theme", "version": "1.2.0", ... }
Defensive patterns

Strategy: validation

Validate before calling

fn text_field_ok(v: &str, max: usize) -> bool {
    let t = v.trim();
    !t.is_empty() && v.len() <= max
}
// name<=100, version<=40, author<=100, license<=100
if ![(&theme.name,100),(&theme.version,40),(&theme.author,100),(&theme.license,100)]
    .iter().all(|(v,max)| text_field_ok(v, *max)) {
    return Err(anyhow::anyhow!("invalid name/version/author/license"));
}

Try / catch

match install_market_theme(state_dir, &theme).await {
    Ok(s) => println!("installed {}", s.id),
    Err(e) if e.to_string().contains("的") && e.to_string().contains("无效") => {
        eprintln!("theme {} has an empty or over-length metadata field — fix the manifest", theme.id);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: install_market_theme_from_base or validate_manifest sees a theme where one of name/version/author/license is whitespace-only, empty, or longer than its limit — e.g. a placeholder version string, an author field pasted with a long bio, or missing values defaulting to empty after JSON parse.

Common situations: Authors leaving draft fields empty when publishing; long SPDX expressions or URLs pasted into license; version strings like full git SHAs exceeding 40 chars; localized names with very long marketing text.

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

Appendix: source

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

            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);
        }
    }
    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] {

View on GitHub (pinned to b1ed92e5e4)