BigPizzaV3/CodexPlusPlus · error · anyhow::Error

prepared Dream Skin image is empty

Error message

prepared Dream Skin image is empty

What it means

macOS-only: after /usr/bin/sips converts the source to JPEG (.dream-skin-import.jpg), the prepared file is stat'd again; a zero-byte result means sips exited successfully but wrote nothing. The library deletes the empty prepared copy (remove_prepared_copy) before bailing. The source was already verified non-empty, so the loss happened during conversion.

Source

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

    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 {
        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() {

View on GitHub (pinned to f2074595a2)

Solutions

  1. Free space or fix write permissions on the volume hosting the managed dream-skin directory
  2. Re-save the source (Preview export) and retry the import
  3. Reproduce with 'sips -s format jpeg SRC --out /tmp/t.jpg' and inspect the output size
Defensive patterns

Strategy: try-catch

Try / catch

Catch anyhow errors from import_dream_skin_image on macOS and match the 'prepared Dream Skin image is empty' message: report a conversion failure and suggest re-saving the image; the source stays untouched because the library already removed the empty prepared copy.

Prevention

When it happens

Trigger: sips quietly emitting an empty file for a source it cannot really decode (some CMYK JPEGs, odd color profiles), or the managed directory sitting on a full or read-only volume.

Common situations: Disk-full on the state-dir volume; sources that Preview opens but sips' non-interactive path cannot.

Related errors


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