BigPizzaV3/CodexPlusPlus · error · anyhow::Error
主题包必须是 32 MiB 以内的普通 ZIP 文件
Error message
主题包必须是 32 MiB 以内的普通 ZIP 文件
What it means
import_theme_package stats the local archive with symlink_metadata and requires a regular file, not a symlink, non-zero length, and at most PACKAGE_BYTES_LIMIT (32 MiB). Anything else - directory, symlink, empty file, oversized export - is rejected up front as not a plain ZIP within 32 MiB.
Source
Thrown at crates/codex-plus-core/src/dream_skin_community.rs:195
|| validated.manifest.version != metadata.version
{
bail!("DreamSkin 主题包身份与审核元数据不一致");
}
crate::dream_skin_library::save_validated_dream_skin_package(state_dir, &validated)
}
pub fn import_theme_package(
state_dir: &Path,
archive_path: &Path,
) -> anyhow::Result<DreamSkinThemeSummary> {
let metadata = std::fs::symlink_metadata(archive_path)
.with_context(|| format!("无法读取主题包:{}", archive_path.display()))?;
if !metadata.file_type().is_file()
|| metadata.file_type().is_symlink()
|| metadata.len() == 0
|| metadata.len() as usize > PACKAGE_BYTES_LIMIT
{
bail!("主题包必须是 32 MiB 以内的普通 ZIP 文件");
}
let bytes = std::fs::read(archive_path)
.with_context(|| format!("无法读取主题包:{}", archive_path.display()))?;
let validated = crate::dream_skin_package::validate_and_read_package(
&bytes,
if cfg!(windows) { "windows" } else { "macos" },
)?;
crate::dream_skin_library::save_validated_dream_skin_package(state_dir, &validated)
}
pub fn save_pending_community_link(url: &str) -> anyhow::Result<String> {
let version_id = version_id_from_link(url)?;
let path = pending_link_path();
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}
crate::settings::atomic_write(
&path,View on GitHub (pinned to f2074595a2)
Solutions
- Resolve to the real file (no symlink) and confirm it opens as a zip
- Re-download when 0 bytes; compress or trim assets when over 32 MiB
- Validate with 'unzip -t' before importing
Defensive patterns
Strategy: validation
Validate before calling
fn is_importable_zip(path: &std::path::Path) -> bool {
match std::fs::symlink_metadata(path) {
Ok(m) => {
m.file_type().is_file()
&& !m.file_type().is_symlink()
&& m.len() > 0
&& m.len() <= 32 * 1024 * 1024
}
Err(_) => false,
}
} Type guard
fn is_importable_zip(path: &std::path::Path) -> bool {
std::fs::symlink_metadata(path)
.map(|m| {
m.file_type().is_file()
&& !m.file_type().is_symlink()
&& m.len() > 0
&& m.len() <= 32 * 1024 * 1024
})
.unwrap_or(false)
} Prevention
- Filter pickers to regular .zip files under 32 MiB
- Run 'unzip -t' on exports before import to catch corrupt archives
- Materialize cloud-sync placeholder zips first
When it happens
Trigger: Passing a symlink to a zip, a directory, a 0-byte failed download, or a 40 MiB export; drag-dropped aliases.
Common situations: Cloud-sync placeholder zips; interrupted downloads; themes embedding oversized assets.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- Dream Skin image is not a file
- Dream Skin image is empty
- Dream Skin source image exceeds 50 MiB
- prepared Dream Skin image exceeds 16 MiB
- DreamSkin 主题版本与请求不一致
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23).
Data as JSON: /api/errors/cf262867374dad76.
Report an issue: GitHub.