BigPizzaV3/CodexPlusPlus · error

manifest.platforms 无效

Error message

manifest.platforms 无效

What it means

validate_manifest rejects the package when manifest.platforms is empty, contains more than 2 entries, has duplicates, or lists any platform other than "macos" or "windows". The library restricts skin packages to its two supported desktop platforms and requires a clean, non-empty list. Thrown during validate_and_read_package before the theme is loaded.

Solutions

  1. Set manifest.platforms to a non-empty subset of ["macos", "windows"]
  2. Remove duplicate platform entries
  3. Cap the list at 2 entries and fix casing to exactly "macos" / "windows"
  4. If you need Linux support, it is not supported by this package format — remove it
  5. Re-validate the package

Example fix

// before (manifest.json)
"platforms": ["macos", "linux"]
// after
"platforms": ["macos"]
Defensive patterns

Strategy: validation

Validate before calling

fn platforms_ok(list: &[String]) -> bool {
    !list.is_empty() && list.len() <= 2
        && list.iter().all(|p| p == "macos" || p == "windows")
        && list.iter().collect::<std::collections::HashSet<_>>().len() == list.len()
}
if !platforms_ok(&manifest.platforms) { /* fix manifest before calling */ }

Type guard

fn has_valid_platform_list(platforms: &[String]) -> bool {
    !platforms.is_empty()
        && platforms.len() <= 2
        && platforms.iter().all(|p| matches!(p.as_str(), "macos" | "windows"))
}

Try / catch

match validate_and_read_package(&path, platform) {
    Err(e) if e.to_string().contains("platforms 无效") => {
        eprintln!("package rejected: bad platforms list in manifest.json");
    }
    other => other?,
}

Prevention

When it happens

Trigger: validate_and_read_package sees a manifest with platforms: [], more than two entries, a duplicated entry like ["macos","macos"], or unsupported values such as "linux", "web", or "MacOS" (case-sensitive).

Common situations: Authoring a theme intended for Linux; generic packaging templates leaving platforms empty; uppercase/lowercase typos like "Windows" or "darwin".

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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

Appendix: source

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

    }
    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) {
        bail!("主题包不支持当前平台:{platform}");
    }
    if manifest.capabilities.is_empty()
        || manifest.capabilities.len() > 3
        || has_duplicates(&manifest.capabilities)
        || manifest
            .capabilities
            .iter()
            .any(|item| !matches!(item.as_str(), "background" | "tokens" | "safe-css"))
        || !manifest.capabilities.iter().any(|item| item == "safe-css")
    {
        bail!("manifest.capabilities 无效或缺少 safe-css 能力");
    }
    if !safe_manifest_text(&manifest.publisher.display_name, 1, 80, false)
        || manifest.publisher.id.is_empty()
        || manifest.publisher.id.len() > 64

View on GitHub (pinned to b1ed92e5e4)