BigPizzaV3/CodexPlusPlus · error
macOS could not convert the Dream Skin image
Error message
macOS could not convert the Dream Skin image: {message} What it means
On macOS, prepare_image shells out to /usr/bin/sips to convert the user-selected Dream Skin image to JPEG before it is placed in the managed theme directory. When sips exits with a non-zero status, the library wraps the converter's stderr in this error via bail!. It means the source image could not be converted (corrupt file, unsupported/odd format variant, or a sips-level failure), so no managed background image was installed.
Solutions
- Open the image in Preview (or run `/usr/bin/sips -s format jpeg <source> --out /tmp/test.jpg` manually) to confirm it is valid; re-export or re-download a healthy copy and retry the import.
- Verify the file is not empty/truncated (`ls -l`, `file <source>`); replace it with a standard PNG or JPEG.
- If sips consistently fails on a valid file (rare macOS/system issue), convert the image yourself with Preview or another tool to a plain JPEG/PNG first, then import that.
- Check that the source path is readable by the current user and not on an unmounted volume.
Example fix
// before: importing a mislabeled file $ file wallpaper.png wallpaper.png: ASCII text // after: validate/convert before import $ sips -s format jpeg wallpaper.png --out wallpaper.jpg error: can't convert... -> fix source or supply a real image $ file wallpaper.jpg wallpaper.jpg: JPEG image data
Defensive patterns
Strategy: try-catch
Validate before calling
import subprocess, pathlib
def is_importable_image(path: str) -> bool:
p = pathlib.Path(path)
if not p.is_file() or p.stat().st_size == 0:
return False
r = subprocess.run(["/usr/bin/sips", "-g", "pixelWidth", str(p)], capture_output=True)
return r.returncode == 0 Type guard
import imghdr # or 'file-type' equivalent
def looks_like_supported_image(path: str) -> bool:
kind = imghdr.what(path)
return kind in {"png", "jpeg", "tiff", "webp"} # heic via file(1) if needed Try / catch
match prepare_dream_skin_image_for_directory(src, dir) {
Ok((prepared, ext)) => install(prepared, ext),
Err(e) if e.to_string().contains("could not convert") => {
eprintln!("Image invalid, ask user to re-export as PNG/JPEG: {e}");
}
Err(e) => return Err(e),
} Prevention
- Validate the image opens in Preview/`sips -g pixelWidth` before importing
- Reject zero-byte or suspiciously small files early with `file <path>`
- Prefer plain PNG/JPEG sources; avoid renamed non-image files
- Re-download or re-export images that came through unreliable transfers
When it happens
Trigger: Calling prepare_dream_skin_image_for_directory on macOS with a source image that sips cannot convert: the file exists and passes the extension check (png/jpg/jpeg/heic/tif/tiff/webp) but sips fails on it — e.g. truncated/corrupt image, zero-byte file, exotic encoding inside an accepted extension, or a source path that sips cannot read. Any non-zero sips exit code triggers it; only failure to spawn sips produces the different 'failed to run macOS image converter' context error instead.
Common situations: User picks a downloaded image with a .png extension that is actually broken or a non-image file; a partially transferred HEIC photo from an iPhone; a disk-image or text file renamed to .png; an image whose bit depth/color profile sips rejects; corrupted file after sync tools mangled it.
Related errors
- 打开 DMG 失败:
- 启动系统浏览器失败:
- macOS app bundles are only supported on macOS
- macOS app did not exit before debug relaunch
- macOS bundle binary is not a regular file
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/d7ed7f0644d0f152.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin.rs:164
}
#[cfg(target_os = "macos")]
fn prepare_image(
source: &Path,
managed_dir: &Path,
_extension: &str,
) -> anyhow::Result<(PathBuf, String)> {
let prepared = managed_dir.join(".dream-skin-import.jpg");
let output = std::process::Command::new("/usr/bin/sips")
.args(["-s", "format", "jpeg"])
.arg(source)
.arg("--out")
.arg(&prepared)
.output()
.context("failed to run macOS image converter")?;
if !output.status.success() {
let message = String::from_utf8_lossy(&output.stderr).trim().to_string();
bail!("macOS could not convert the Dream Skin image: {message}");
}
Ok((prepared, "jpg".to_string()))
}
#[cfg(not(target_os = "macos"))]
fn prepare_image(
source: &Path,
_managed_dir: &Path,
extension: &str,
) -> anyhow::Result<(PathBuf, String)> {
Ok((source.to_path_buf(), extension.to_string()))
}
fn remove_prepared_copy(source: &Path, prepared: &Path) {
if prepared != source {
let _ = std::fs::remove_file(prepared);
}
}View on GitHub (pinned to b1ed92e5e4)