{"record":{"id":"708617d04297bec5","repo":"BigPizzaV3/CodexPlusPlus","slug":"dream-skin-image-is-empty","errorCode":null,"errorMessage":"Dream Skin image is empty","messagePattern":"Dream Skin image is empty","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin.rs","lineNumber":56,"sourceCode":"pub(crate) fn prepare_dream_skin_image_for_directory(\n    source: &Path,\n    destination_dir: &Path,\n    destination_stem: &str,\n) -> anyhow::Result<PathBuf> {\n    if destination_stem.is_empty()\n        || !destination_stem\n            .bytes()\n            .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_'))\n    {\n        bail!(\"invalid Dream Skin destination name\");\n    }\n    let metadata = std::fs::symlink_metadata(source)\n        .with_context(|| format!(\"failed to read image metadata {}\", source.display()))?;\n    if !metadata.file_type().is_file() || metadata.file_type().is_symlink() {\n        bail!(\"Dream Skin image is not a file\");\n    }\n    if metadata.len() == 0 {\n        bail!(\"Dream Skin image is empty\");\n    }\n    if metadata.len() > DREAM_SKIN_SOURCE_LIMIT {\n        bail!(\"Dream Skin source image exceeds 50 MiB\");\n    }\n\n    let extension = supported_image_extension(source)?;\n    std::fs::create_dir_all(destination_dir).with_context(|| {\n        format!(\n            \"failed to create Dream Skin theme directory {}\",\n            destination_dir.display()\n        )\n    })?;\n\n    let (prepared_path, prepared_extension) = prepare_image(source, destination_dir, &extension)?;\n    let prepared_metadata = std::fs::metadata(&prepared_path).with_context(|| {\n        format!(\n            \"failed to read prepared image metadata {}\",\n            prepared_path.display()","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin.rs#L38-L74","documentation":"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.","triggerScenarios":"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.","commonSituations":"Cloud-sync placeholders that exist at 0 bytes until opened; interrupted exports; upload pipelines creating the target before the bytes arrive.","solutions":["Choose a non-empty image file when importing a theme","Re-export/redownload the image if it was truncated","Check the source disk/file for corruption"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn is_non_empty_file(path: &std::path::Path) -> bool {\n    std::fs::symlink_metadata(path).map(|m| m.len() > 0).unwrap_or(false)\n}","typeGuard":"fn is_non_empty_file(path: &std::path::Path) -> bool {\n    std::fs::symlink_metadata(path).map(|m| m.len() > 0).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Force cloud-sync placeholders to materialize before import","Show file size in the picker and disable import for 0-byte entries"],"tags":["dream-skin","empty-file","filesystem","rust"],"backgroundTag":"empty-file","analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}