{"record":{"id":"18d08cd5a222fc21","repo":"BigPizzaV3/CodexPlusPlus","slug":"manifest-platforms","errorCode":null,"errorMessage":"manifest.platforms 无效","messagePattern":"manifest\\.platforms 无效","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":934,"sourceCode":"    }\n    if !valid_semver(&manifest.version) || !valid_semver(&manifest.min_client_version) {\n        bail!(\"manifest 版本号无效\");\n    }\n    if compare_semver(&manifest.min_client_version, \"1.5.12\").is_gt() {\n        bail!(\n            \"主题包需要更新版本的 Dream Skin 协议：{}\",\n            manifest.min_client_version\n        );\n    }\n    if manifest.platforms.is_empty()\n        || manifest.platforms.len() > 2\n        || has_duplicates(&manifest.platforms)\n        || manifest\n            .platforms\n            .iter()\n            .any(|item| !matches!(item.as_str(), \"macos\" | \"windows\"))\n    {\n        bail!(\"manifest.platforms 无效\");\n    }\n    if !manifest.platforms.iter().any(|item| item == platform) {\n        bail!(\"主题包不支持当前平台：{platform}\");\n    }\n    if manifest.capabilities.is_empty()\n        || manifest.capabilities.len() > 3\n        || has_duplicates(&manifest.capabilities)\n        || manifest\n            .capabilities\n            .iter()\n            .any(|item| !matches!(item.as_str(), \"background\" | \"tokens\" | \"safe-css\"))\n        || !manifest.capabilities.iter().any(|item| item == \"safe-css\")\n    {\n        bail!(\"manifest.capabilities 无效或缺少 safe-css 能力\");\n    }\n    if !safe_manifest_text(&manifest.publisher.display_name, 1, 80, false)\n        || manifest.publisher.id.is_empty()\n        || manifest.publisher.id.len() > 64","sourceCodeStart":916,"sourceCodeEnd":952,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L916-L952","documentation":"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.","triggerScenarios":"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).","commonSituations":"Authoring a theme intended for Linux; generic packaging templates leaving platforms empty; uppercase/lowercase typos like \"Windows\" or \"darwin\".","solutions":["Set manifest.platforms to a non-empty subset of [\"macos\", \"windows\"]","Remove duplicate platform entries","Cap the list at 2 entries and fix casing to exactly \"macos\" / \"windows\"","If you need Linux support, it is not supported by this package format — remove it","Re-validate the package"],"exampleFix":"// before (manifest.json)\n\"platforms\": [\"macos\", \"linux\"]\n// after\n\"platforms\": [\"macos\"]","handlingStrategy":"validation","validationCode":"fn platforms_ok(list: &[String]) -> bool {\n    !list.is_empty() && list.len() <= 2\n        && list.iter().all(|p| p == \"macos\" || p == \"windows\")\n        && list.iter().collect::<std::collections::HashSet<_>>().len() == list.len()\n}\nif !platforms_ok(&manifest.platforms) { /* fix manifest before calling */ }","typeGuard":"fn has_valid_platform_list(platforms: &[String]) -> bool {\n    !platforms.is_empty()\n        && platforms.len() <= 2\n        && platforms.iter().all(|p| matches!(p.as_str(), \"macos\" | \"windows\"))\n}","tryCatchPattern":"match validate_and_read_package(&path, platform) {\n    Err(e) if e.to_string().contains(\"platforms 无效\") => {\n        eprintln!(\"package rejected: bad platforms list in manifest.json\");\n    }\n    other => other?,\n}","preventionTips":["Only ever write \"macos\" and/or \"windows\" (lowercase) into platforms","Use fixed templates instead of free-form platform arrays","Lint manifests before packaging"],"tags":["manifest","platform","validation"],"backgroundTag":"unsupported-platform","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}