BigPizzaV3/CodexPlusPlus · error · anyhow::Error

Dream Skin image is empty

Error message

Dream Skin image is empty

What it means

Validation in prepare_dream_skin_image_for_directory: the source image file supplied for a Dream Skin theme is empty (zero-length file), so there is no image content to copy into the theme directory. Fired after metadata checks confirm the path is a regular file but with no bytes.

Source

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

pub(crate) fn prepare_dream_skin_image_for_directory(
    source: &Path,
    destination_dir: &Path,
    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()

View on GitHub (pinned to f2074595a2)

Solutions

  1. Choose a non-empty image file when importing a theme
  2. Re-export/redownload the image if it was truncated
  3. Check the source disk/file for corruption
Defensive patterns

Strategy: validation

Validate before calling

fn is_non_empty_file(path: &std::path::Path) -> bool {
    std::fs::symlink_metadata(path).map(|m| m.len() > 0).unwrap_or(false)
}

Type guard

fn is_non_empty_file(path: &std::path::Path) -> bool {
    std::fs::symlink_metadata(path).map(|m| m.len() > 0).unwrap_or(false)
}

Prevention

When it happens

Trigger: Selecting a file that failed to download or save completely; a cloud-sync placeholder (iCloud/OneDrive) whose content has not materialized; a file caught mid-write by a temp-file creator.

Common situations: Cloud-sync placeholders that exist at 0 bytes until opened; interrupted exports; upload pipelines creating the target before the bytes arrive.

Related errors


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