BigPizzaV3/CodexPlusPlus · error

Dream Skin 主题包为空

Error message

Dream Skin 主题包为空

What it means

normalize_package_entries drops entries with no content (directories/null entries) and then requires at least one file entry; if all entries are empty it bails with this message. An empty package cannot define a theme.

Solutions

  1. Include at least one real file (e.g. manifest.json, theme.css) in the archive and repack.
  2. Zip the theme files themselves rather than the containing folder.
  3. Check the archive integrity; rebuild it if entries lost their data.

Example fix

# before: zip contains only 'theme/' directory
# after:
zip -r theme.dskin manifest.json theme.css background.png
Defensive patterns

Strategy: validation

Validate before calling

fn package_has_files(entries: &[(String, Option<Vec<u8>>)]) -> bool {
    entries.iter().any(|(_, c)| c.is_some())
}

Try / catch

match validate_and_read_package(path, platform) {
    Ok(pkg) => install(pkg),
    Err(e) if e.to_string().contains("主题包为空") => eprintln!("archive has no file entries; repack with real files"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: validate_and_read_package passes an archive containing only directory entries or entries with None content, so content_entries.is_empty() becomes true.

Common situations: Zipping an empty folder; an archiver that stores only directory records; a truncated or corrupted archive where file data is missing.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

        || name.contains(['\0', ':'])
        || name.split('/').any(|part| part == "." || part == "..")
        || (!name.starts_with("__MACOSX/")
            && name.split('/').filter(|part| !part.is_empty()).count() > 2)
    {
        bail!("主题包文件名不安全:{name}");
    }
    Ok(())
}

fn normalize_package_entries(
    entries: Vec<(String, Option<Vec<u8>>)>,
) -> anyhow::Result<std::collections::BTreeMap<String, Vec<u8>>> {
    let content_entries = entries
        .into_iter()
        .filter_map(|(name, content)| content.map(|content| (name, content)))
        .collect::<Vec<_>>();
    if content_entries.is_empty() {
        bail!("Dream Skin 主题包为空");
    }

    let root_files = content_entries.iter().any(|(name, _)| !name.contains('/'));
    let prefix = if root_files {
        if content_entries.iter().any(|(name, _)| name.contains('/')) {
            bail!("主题包文件必须全部位于根目录或唯一一层主题目录");
        }
        None
    } else {
        let prefix = content_entries[0]
            .0
            .split_once('/')
            .map(|(prefix, _)| prefix)
            .context("主题包顶级目录无效")?;
        if prefix.is_empty()
            || content_entries.iter().any(|(name, _)| {
                name.split_once('/').is_none_or(|(candidate, file)| {
                    candidate != prefix || file.is_empty() || file.contains('/')

View on GitHub (pinned to b1ed92e5e4)