BigPizzaV3/CodexPlusPlus · error

manifest 版本号无效

Error message

manifest 版本号无效

What it means

validate_manifest rejects the package when either manifest.version or manifest.minClientVersion is not a valid semver string per valid_semver. Both fields must be parseable as x.y.z-style versions because the library compares minClientVersion against the supported protocol floor (1.5.12) in the next check. This error is thrown during validate_and_read_package before the package is accepted.

Solutions

  1. Set manifest.version to a valid x.y.z semver string
  2. Set manifest.minClientVersion to a valid x.y.z semver string
  3. Remove any 'v' prefix, range operators, or extra metadata from both fields
  4. Re-validate the package

Example fix

// before (manifest.json)
"version": "v2.0",
"minClientVersion": "1.5"
// after
"version": "2.0.0",
"minClientVersion": "1.5.12"
Defensive patterns

Strategy: validation

Validate before calling

fn is_semver(s: &str) -> bool {
    let parts: Vec<&str> = s.trim_start_matches('v').split('.').collect();
    parts.len() == 3 && parts.iter().all(|p| !p.is_empty() && p.chars().all(|c| c.is_ascii_digit()))
}
assert!(is_semver(&manifest.version) && is_semver(&manifest.min_client_version));

Type guard

fn is_valid_semver(s: &str) -> bool {
    let parts: Vec<&str> = s.split('.').collect();
    parts.len() == 3 && parts.iter().all(|p| !p.is_empty() && p.chars().all(|c| c.is_ascii_digit()))
}

Try / catch

match validate_and_read_package(&path, platform) {
    Err(e) if e.to_string().contains("版本号无效") => {
        eprintln!("package rejected: version fields must be x.y.z semver");
    }
    other => other?,
}

Prevention

When it happens

Trigger: validate_and_read_package encounters a manifest whose version or minClientVersion is empty, missing components (e.g. "1.5"), has a non-numeric component, or contains a prefix like "v1.5.12" that valid_semver rejects.

Common situations: Hand-written manifests using "v" prefixes; two-part versions; dates used as versions ("2024-01-01"); build metadata or ranges ("^1.0.0", ">=1.0").

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_package.rs:918

        "theme.css" => CSS_LIMIT,
        "LICENSE.txt" => LICENSE_LIMIT,
        "manifest.sig" => SIGNATURE_LIMIT,
        _ => IMAGE_LIMIT,
    }
}

fn validate_manifest(manifest: &DreamSkinPackageManifest, platform: &str) -> anyhow::Result<()> {
    if manifest.package_version != 1 || manifest.skin_api_version != 1 {
        bail!("不支持的 Dream Skin 主题协议版本");
    }
    if manifest.theme_id.chars().count() < 3
        || manifest.theme_id.chars().count() > 64
        || !valid_theme_id(&manifest.theme_id)
    {
        bail!("manifest.themeId 无效");
    }
    if !valid_semver(&manifest.version) || !valid_semver(&manifest.min_client_version) {
        bail!("manifest 版本号无效");
    }
    if compare_semver(&manifest.min_client_version, "1.5.12").is_gt() {
        bail!(
            "主题包需要更新版本的 Dream Skin 协议:{}",
            manifest.min_client_version
        );
    }
    if manifest.platforms.is_empty()
        || manifest.platforms.len() > 2
        || has_duplicates(&manifest.platforms)
        || manifest
            .platforms
            .iter()
            .any(|item| !matches!(item.as_str(), "macos" | "windows"))
    {
        bail!("manifest.platforms 无效");
    }
    if !manifest.platforms.iter().any(|item| item == platform) {

View on GitHub (pinned to b1ed92e5e4)