{"record":{"id":"4363b6e8c594bafd","repo":"BigPizzaV3/CodexPlusPlus","slug":"dreamskin-id","errorCode":null,"errorMessage":"DreamSkin 主题版本 ID 无效","messagePattern":"DreamSkin 主题版本 ID 无效","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_community.rs","lineNumber":316,"sourceCode":"fn validate_community_theme(theme: &DreamSkinCommunityTheme) -> anyhow::Result<()> {\n    validate_version_id(&theme.id)?;\n    if !safe_text(&theme.theme_id, 80)\n        || !safe_text(&theme.name, 120)\n        || !safe_text(&theme.author_display_name, 120)\n        || !safe_text(&theme.license, 80)\n        || !valid_semver(&theme.version)\n        || theme.package_bytes == 0\n        || theme.package_bytes > PACKAGE_BYTES_LIMIT\n        || !valid_sha256(&theme.package_sha256)\n    {\n        bail!(\"DreamSkin 社区主题元数据无效：{}\", theme.id);\n    }\n    Ok(())\n}\n\nfn validate_version_id(value: &str) -> anyhow::Result<()> {\n    let Some(suffix) = value.strip_prefix(\"ver_\") else {\n        bail!(\"DreamSkin 主题版本 ID 无效\");\n    };\n    if !(8..=64).contains(&suffix.len())\n        || !suffix\n            .bytes()\n            .all(|byte| byte.is_ascii_lowercase() || byte.is_ascii_digit())\n    {\n        bail!(\"DreamSkin 主题版本 ID 无效\");\n    }\n    Ok(())\n}\n\nfn safe_text(value: &str, maximum: usize) -> bool {\n    let trimmed = value.trim();\n    value == trimmed\n        && !value.is_empty()\n        && value.chars().count() <= maximum\n        && value\n            .chars()","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_community.rs#L298-L334","documentation":"validate_version_id requires a DreamSkin theme version id to start with the literal prefix 'ver_'. Values without that prefix are rejected with this error. It is applied to version ids coming from catalog metadata, link URLs, and pending-link records before any further validation.","triggerScenarios":"Passing a version id string that does not begin with 'ver_' to validate_version_id, directly or via install_community_theme, version_id_from_link, load_pending_community_link, or validate_community_theme (e.g. a bare hash, a URL-encoded id, or a numeric id).","commonSituations":"Parsing a share link and grabbing the wrong query parameter; a service API change returning ids without the ver_ prefix; hand-crafted test fixtures using simplified ids.","solutions":["Ensure the id string starts with 'ver_' — e.g. extract it with the library's version_id_from_link rather than ad-hoc string splitting.","Refresh the catalog/link data if upstream changed its id format.","Fix the pending-link record file so its versionId field holds a ver_-prefixed id."],"exampleFix":"// before\nlet id = \"abc12345\";\n// after\nlet id = \"ver_abc12345\";","handlingStrategy":"validation","validationCode":"// Rust\nfn looks_like_version_id(s: &str) -> bool { s.starts_with(\"ver_\") }","typeGuard":null,"tryCatchPattern":"// Rust\nmatch version_id_from_link(&url) {\n    Ok(id) => install(...),\n    Err(e) if e.to_string().contains(\"版本 ID 无效\") => eprintln!(\"链接中的版本 ID 格式不正确\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Extract ids via the library's link parser, not manual string ops","Validate ids with a ^ver_[a-z0-9]{8,64}$ regex before use","Keep id formats in sync with the service contract"],"tags":["validation","identifier-format"],"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"}