BigPizzaV3/CodexPlusPlus · error
主题包必须是 32 MiB 以内的普通 ZIP 文件
Error message
主题包必须是 32 MiB 以内的普通 ZIP 文件
What it means
import_theme_package rejects any archive that is not a regular, non-empty, non-symlink file of at most PACKAGE_BYTES_LIMIT (32 MiB). The check runs on symlink_metadata before reading the file, guarding against symlink trickery, directories, and oversized payloads. This is a size/type gate applied before the ZIP is validated and parsed.
Solutions
- Verify the path points to a real regular file: check fs::metadata(path).is_file() and len() <= 32*1024*1024 before importing.
- Re-export or re-zip the theme so it is under 32 MiB (compress or drop large preview assets).
- Ensure the download/export fully completed (no 0-byte or partial files).
- Resolve symlinks to their target file before passing the path.
Example fix
// before
import_theme_package(state_dir, &maybe_symlink_path)?;
// after
let md = std::fs::metadata(&path)?;
if md.is_file() && md.len() > 0 && md.len() <= 32 * 1024 * 1024 {
import_theme_package(state_dir, &path)?;
} Defensive patterns
Strategy: validation
Validate before calling
// Rust let md = std::fs::metadata(&path)?; let ok = md.is_file() && md.len() > 0 && md.len() <= 32 * 1024 * 1024;
Try / catch
// Rust
match import_theme_package(state_dir, &path) {
Ok(t) => t,
Err(e) if e.to_string().contains("32 MiB") => eprintln!("请选择一个 32 MiB 以内的 ZIP 文件"),
Err(e) => return Err(e),
} Prevention
- Validate file size and type in the file picker before handing the path to the library
- Complete downloads fully (check .part files are renamed)
- Keep theme exports under 32 MiB by compressing preview assets
- Resolve symlinks before passing paths
When it happens
Trigger: Calling import_theme_package with archive_path pointing at: a directory, a symlink, an empty file, a file larger than 32 MiB, or a special (non-regular) file.
Common situations: User picks the wrong file in a file dialog (e.g. a folder or a .zip.part download in progress); exporting a theme with large embedded assets blows past 32 MiB; a symlinked path in a shared state dir.
Understand the failure class
Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.
Related errors
- Dream Skin 主题包为空
- Dream Skin 主题包文件数量必须在 1 到 32 之间
- Dream Skin 主题包超过 32 MiB 限制
- Dream Skin theme config exceeds 256 KiB
- 主题包必须且只能包含一个背景图片
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/cf262867374dad76.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_community.rs:201
|| 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 b1ed92e5e4)