BigPizzaV3/CodexPlusPlus · error

Dream Skin source image exceeds 50 MiB

Error message

Dream Skin source image exceeds 50 MiB

What it means

After confirming the source is a regular file, the same guard checks metadata.len() against a 50 MiB cap and bails when the Dream Skin source image exceeds it. It protects config directories and UI loading from oversized payloads; empty files are rejected just before this check.

Solutions

  1. Downscale or re-encode the image (resize to screen resolution, convert to PNG/JPEG/WebP) to get under 50 MiB.
  2. Strip metadata (EXIF) with a tool like ImageMagick ('magick input.png -strip output.png') to reduce size.
  3. If the use case legitimately needs bigger sources, raise DREAM_SKIN_SOURCE_LIMIT in dream_skin.rs and rebuild.

Example fix

// shell preparation before import
// before: importing 80 MiB raw.png
magick raw.png -resize 3840x2160 -strip theme.png  # after: well under 50 MiB
import_dream_skin_image("theme.png", dir, stem)?;
Defensive patterns

Strategy: validation

Validate before calling

const DREAM_SKIN_SOURCE_LIMIT: u64 = 50 * 1024 * 1024;
let md = std::fs::metadata(&source)?;
if md.len() > DREAM_SKIN_SOURCE_LIMIT {
    eprintln!("image too large ({} bytes); downscale before import", md.len());
    return Ok(()); // or run an automatic resize
}

Prevention

When it happens

Trigger: import_dream_skin_image receives a source image whose metadata.len() exceeds 50 MiB, checked in prepare_dream_skin_image_for_directory.

Common situations: Importing raw camera photos, multi-megabyte PNG screenshots at 5K resolution, or uncompressed TIFF/BMP files exported from editors.

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


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

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin.rs:60

    destination_stem: &str,
) -> anyhow::Result<PathBuf> {
    if destination_stem.is_empty()
        || !destination_stem
            .bytes()
            .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_'))
    {
        bail!("invalid Dream Skin destination name");
    }
    let metadata = std::fs::symlink_metadata(source)
        .with_context(|| format!("failed to read image metadata {}", source.display()))?;
    if !metadata.file_type().is_file() || metadata.file_type().is_symlink() {
        bail!("Dream Skin image is not a file");
    }
    if metadata.len() == 0 {
        bail!("Dream Skin image is empty");
    }
    if metadata.len() > DREAM_SKIN_SOURCE_LIMIT {
        bail!("Dream Skin source image exceeds 50 MiB");
    }

    let extension = supported_image_extension(source)?;
    std::fs::create_dir_all(destination_dir).with_context(|| {
        format!(
            "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 {

View on GitHub (pinned to b1ed92e5e4)