{"record":{"id":"234be1c2d15f3028","repo":"BigPizzaV3/CodexPlusPlus","slug":"manifest-themeid","errorCode":null,"errorMessage":"manifest.themeId 无效","messagePattern":"manifest\\.themeId 无效","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":915,"sourceCode":"    match name {\n        \"manifest.json\" => MANIFEST_LIMIT,\n        \"theme.json\" => THEME_LIMIT,\n        \"theme.css\" => CSS_LIMIT,\n        \"LICENSE.txt\" => LICENSE_LIMIT,\n        \"manifest.sig\" => SIGNATURE_LIMIT,\n        _ => IMAGE_LIMIT,\n    }\n}\n\nfn validate_manifest(manifest: &DreamSkinPackageManifest, platform: &str) -> anyhow::Result<()> {\n    if manifest.package_version != 1 || manifest.skin_api_version != 1 {\n        bail!(\"不支持的 Dream Skin 主题协议版本\");\n    }\n    if manifest.theme_id.chars().count() < 3\n        || manifest.theme_id.chars().count() > 64\n        || !valid_theme_id(&manifest.theme_id)\n    {\n        bail!(\"manifest.themeId 无效\");\n    }\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    {","sourceCodeStart":897,"sourceCodeEnd":933,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L897-L933","documentation":"validate_manifest rejects the package when manifest.themeId is shorter than 3 or longer than 64 characters, or fails valid_theme_id's character-set check. The library enforces strict identifier rules because the themeId is used as a directory-safe identity key matching theme.json's id. The error is thrown during package validation before any theme is applied.","triggerScenarios":"Calling validate_and_read_package on a Dream Skin package whose manifest.json has a themeId with fewer than 3 or more than 64 characters, or containing characters outside the set allowed by valid_theme_id (e.g. spaces, slashes, non-ASCII, or invalid symbols).","commonSituations":"Hand-edited manifest.json; authoring tools that emit a display name instead of an id; renamed themes keeping punctuation; copy-pasted ids with trailing whitespace or unicode lookalikes.","solutions":["Open the package's manifest.json and shorten/lengthen themeId to 3-64 characters","Remove any characters not accepted by valid_theme_id (keep it a simple identifier, e.g. [a-z0-9-] style)","Ensure theme.json's top-level id matches the corrected themeId","Repackage and re-validate with validate_and_read_package"],"exampleFix":"// before (manifest.json)\n\"themeId\": \"My Theme!\"\n// after\n\"themeId\": \"my-theme-01\"","handlingStrategy":"validation","validationCode":"fn theme_id_ok(id: &str) -> bool {\n    let n = id.chars().count();\n    (3..=64).contains(&n) && id.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')\n}\nif !theme_id_ok(&manifest.theme_id) { /* fix before calling */ }","typeGuard":"fn is_valid_theme_id(id: &str) -> bool {\n    let n = id.chars().count();\n    (3..=64).contains(&n) && id.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')\n}","tryCatchPattern":"match validate_and_read_package(&path, platform) {\n    Err(e) if e.to_string().contains(\"themeId 无效\") => {\n        eprintln!(\"package rejected: invalid themeId — regenerate manifest.json\");\n    }\n    other => other?,\n}","preventionTips":["Generate themeId programmatically from a slugifier, never by hand","Keep ids as [a-z0-9-_], 3-64 chars","Mirror the same id into theme.json's id field"],"tags":["manifest","validation","theme-package"],"backgroundTag":"invalid-identifier-format","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"}