BigPizzaV3/CodexPlusPlus · error
Dream Skin image is empty
Error message
Dream Skin image is empty
What it means
prepare_dream_skin_image_for_directory rejects the source when symlink_metadata shows it is not a regular file (directory, or a symlink — symlinks are explicitly treated as untrusted). This is a path-traversal/safety guard: Dream Skin imports must be plain image files copied into config directories, never links pointing outside.
Solutions
- Re-export or re-download the image; confirm it opens in an image viewer.
- Check the source size before importing (std::fs::metadata(path)?.len() > 0).
- If the file is being produced asynchronously, wait for the writer to finish (e.g. rename-into-place pattern) before importing.
Example fix
// before import_dream_skin_image(&maybe_empty, &dir, &stem)?; // after let md = std::fs::metadata(&maybe_empty)?; anyhow::ensure!(md.len() > 0, "source image is empty"); import_dream_skin_image(&maybe_empty, &dir, &stem)?;
Defensive patterns
Strategy: validation
Validate before calling
let md = std::fs::metadata(&source)?;
if md.len() == 0 { return Err(anyhow!("refusing to import empty image")); } Type guard
fn is_non_empty_file(p: &std::path::Path) -> bool {
std::fs::metadata(p).map_or(false, |md| md.len() > 0)
} Prevention
- Verify downloads complete before importing (check size against expected)
- Use atomic write-then-rename when producing source images
- Sanity-check the image opens in a viewer before automated imports
When it happens
Trigger: import_dream_skin_image is called with a source image whose metadata.len() == 0 (a 0-byte file), detected in prepare_dream_skin_image_for_directory.
Common situations: A truncated or failed download that left an empty file; a placeholder file created by a crashed export; a file still being written when import started.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Codex CLI 路径指向的是目录而不是可执行文件:
- Codex CLI 没有执行权限:
- Codex CLI 路径不存在: 请填 Codex CLI 可执行文件的完整路径。macOS 桌面版通常在…
- Dream Skin image is not a file
- Dream Skin source image exceeds 50 MiB
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/708617d04297bec5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin.rs:57
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 b1ed92e5e4)