BigPizzaV3/CodexPlusPlus · error · anyhow::Error

Dream Skin source image exceeds 50 MiB

Error message

Dream Skin source image exceeds 50 MiB

What it means

The source image exceeds DREAM_SKIN_SOURCE_LIMIT (50 MiB) per symlink_metadata. This pre-conversion cap bounds imports; on non-macOS the file is copied as-is into the managed theme dir, so the limit also bounds the stored asset.

Source

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

    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 f2074595a2)

Solutions

  1. Re-encode as JPEG or compressed PNG and retry
  2. Downscale the image - dimensions drive the byte size, not format alone
  3. Enforce a 50 MiB cap at selection time in your own UI
Defensive patterns

Strategy: validation

Validate before calling

fn within_source_limit(path: &std::path::Path) -> bool {
    std::fs::symlink_metadata(path)
        .map(|m| m.len() <= 50 * 1024 * 1024)
        .unwrap_or(false)
}

Type guard

fn within_source_limit(path: &std::path::Path) -> bool {
    std::fs::symlink_metadata(path)
        .map(|m| m.len() <= 50 * 1024 * 1024)
        .unwrap_or(false)
}

Prevention

When it happens

Trigger: Importing uncompressed TIFF-class files, 100-megapixel photos, or lossless wallpapers downloaded at full resolution.

Common situations: 4K/8K wallpapers exported losslessly; RAW-to-TIFF exports from photo tools; generative-art PNGs with huge dimensions.

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


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