BigPizzaV3/CodexPlusPlus · error

DreamSkin 主题版本 ID 无效

Error message

DreamSkin 主题版本 ID 无效

What it means

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.

Solutions

  1. 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.
  2. Refresh the catalog/link data if upstream changed its id format.
  3. Fix the pending-link record file so its versionId field holds a ver_-prefixed id.

Example fix

// before
let id = "abc12345";
// after
let id = "ver_abc12345";
Defensive patterns

Strategy: validation

Validate before calling

// Rust
fn looks_like_version_id(s: &str) -> bool { s.starts_with("ver_") }

Try / catch

// Rust
match version_id_from_link(&url) {
    Ok(id) => install(...),
    Err(e) if e.to_string().contains("版本 ID 无效") => eprintln!("链接中的版本 ID 格式不正确"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_community.rs:316

fn validate_community_theme(theme: &DreamSkinCommunityTheme) -> anyhow::Result<()> {
    validate_version_id(&theme.id)?;
    if !safe_text(&theme.theme_id, 80)
        || !safe_text(&theme.name, 120)
        || !safe_text(&theme.author_display_name, 120)
        || !safe_text(&theme.license, 80)
        || !valid_semver(&theme.version)
        || theme.package_bytes == 0
        || theme.package_bytes > PACKAGE_BYTES_LIMIT
        || !valid_sha256(&theme.package_sha256)
    {
        bail!("DreamSkin 社区主题元数据无效:{}", theme.id);
    }
    Ok(())
}

fn validate_version_id(value: &str) -> anyhow::Result<()> {
    let Some(suffix) = value.strip_prefix("ver_") else {
        bail!("DreamSkin 主题版本 ID 无效");
    };
    if !(8..=64).contains(&suffix.len())
        || !suffix
            .bytes()
            .all(|byte| byte.is_ascii_lowercase() || byte.is_ascii_digit())
    {
        bail!("DreamSkin 主题版本 ID 无效");
    }
    Ok(())
}

fn safe_text(value: &str, maximum: usize) -> bool {
    let trimmed = value.trim();
    value == trimmed
        && !value.is_empty()
        && value.chars().count() <= maximum
        && value
            .chars()

View on GitHub (pinned to b1ed92e5e4)