BigPizzaV3/CodexPlusPlus · error

主题包不支持当前平台:

Error message

主题包不支持当前平台:{platform}

What it means

validate_manifest rejects the package when the current host platform (the `platform` argument passed in) is not listed in manifest.platforms. Unlike error 203 (malformed platform list), the list itself may be valid — the package simply does not support this machine's OS. The message includes the unsupported platform string.

Solutions

  1. Choose a theme package whose platforms include your current OS
  2. Ask the author to add your platform to manifest.platforms if the theme is OS-agnostic in practice
  3. Verify the manifest platforms field and your platform detection agree on the exact strings "macos"/"windows"
  4. Skip validation of this package on unsupported machines rather than treating it as a corrupt package
Defensive patterns

Strategy: validation

Validate before calling

let current = if cfg!(target_os = "macos") { "macos" } else { "windows" };
if manifest.platforms.iter().any(|p| p == current) {
    validate_and_read_package(&path, current)?;
}

Type guard

fn supports_current_platform(platforms: &[String], platform: &str) -> bool {
    platforms.iter().any(|p| p == platform)
}

Try / catch

match validate_and_read_package(&path, platform) {
    Err(e) if e.to_string().contains("不支持当前平台") => {
        eprintln!("theme not available for {platform}: {e}"); // degrade gracefully
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling validate_and_read_package on a machine whose platform string (e.g. "windows") is absent from the manifest's platforms array, e.g. a macOS-only theme opened on Windows.

Common situations: Sharing themes across OSes; downloading a platform-specific theme from a gallery; switching machines and reusing the same package directory.

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

Appendix: source

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

    }
    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
        || !manifest
            .publisher
            .id

View on GitHub (pinned to b1ed92e5e4)