BigPizzaV3/CodexPlusPlus · error
prepared Dream Skin image exceeds 16 MiB
Error message
prepared Dream Skin image exceeds 16 MiB
What it means
The prepared (transcoded) image must fit within DREAM_SKIN_PREPARED_LIMIT (16 MiB); when it exceeds this the function removes the prepared copy and bails. The limit bounds final theme asset size shipped/stored per directory.
Solutions
- Start from a smaller/optimized source: resize to actual display dimensions before import.
- Re-export the source as PNG or JPEG rather than GIF/WebP with huge frames, so the prepared output stays small.
- Check which extension prepare_image produced and whether the conversion inflated size; pick a source format that transcodes compactly.
- If 16 MiB is genuinely too small for your theme, raise DREAM_SKIN_PREPARED_LIMIT in dream_skin.rs.
Example fix
// before: 30 MiB GIF transcoded to oversized output fails
import_dream_skin_image("big.gif", dir, stem)?; // -> prepared exceeds 16 MiB
// after: pre-shrink the source
// magick big.gif -coalesce -resize 1920x1080 small.gif
import_dream_skin_image("small.gif", dir, stem)?; Defensive patterns
Strategy: validation
Validate before calling
// pre-shrink the source so the prepared output stays under 16 MiB
let md = std::fs::metadata(&source)?;
if md.len() > 8 * 1024 * 1024 {
// run: magick source.png -resize 3840x2160 -strip source_small.png
return import_dream_skin_image(Path::new("source_small.png"), dir, stem);
} Prevention
- Import sources already sized to display resolution
- Prefer PNG/JPEG sources over formats that inflate during transcoding (large GIFs)
- Spot-check prepared output sizes once with a representative image before batch imports
When it happens
Trigger: prepare_image produces an output larger than 16 MiB even though the source was under the 50 MiB source limit — e.g. transcoding a compressible JPEG into a huge lossless PNG — detected by the prepared_metadata.len() > DREAM_SKIN_PREPARED_LIMIT check.
Common situations: A large animated GIF or high-detail PNG that expands when re-encoded; preparing a 40 MiB JPEG into an uncompressed intermediate format; very high-resolution wallpapers.
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 source image exceeds 50 MiB
- prepared Dream Skin image is empty
- Codex CLI 路径指向的是目录而不是可执行文件:
- Codex CLI 没有执行权限:
- Codex CLI 路径不存在: 请填 Codex CLI 可执行文件的完整路径。macOS 桌面版通常在…
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/6efd0d239b79901c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin.rs:84
"failed to create Dream Skin theme directory {}",
destination_dir.display()
)
})?;
let (prepared_path, prepared_extension) = prepare_image(source, destination_dir, &extension)?;
let prepared_metadata = std::fs::metadata(&prepared_path).with_context(|| {
format!(
"failed to read prepared image metadata {}",
prepared_path.display()
)
})?;
if prepared_metadata.len() == 0 {
remove_prepared_copy(source, &prepared_path);
bail!("prepared Dream Skin image is empty");
}
if prepared_metadata.len() > DREAM_SKIN_PREPARED_LIMIT {
remove_prepared_copy(source, &prepared_path);
bail!("prepared Dream Skin image exceeds 16 MiB");
}
let destination = destination_dir.join(format!("{destination_stem}.{prepared_extension}"));
let bytes = std::fs::read(&prepared_path)
.with_context(|| format!("failed to read prepared image {}", prepared_path.display()))?;
crate::settings::atomic_write(&destination, &bytes)
.with_context(|| format!("failed to store Dream Skin image {}", destination.display()))?;
remove_prepared_copy(source, &prepared_path);
Ok(destination)
}
pub fn clear_managed_dream_skin_image(state_dir: &Path) -> anyhow::Result<()> {
let managed_dir = state_dir.join(MANAGED_THEME_DIR);
if !managed_dir.is_dir() {
return Ok(());
}
for entry in std::fs::read_dir(&managed_dir)
.with_context(|| format!("failed to read {}", managed_dir.display()))?View on GitHub (pinned to b1ed92e5e4)