{"record":{"id":"35ef01efb0b94d56","repo":"BigPizzaV3/CodexPlusPlus","slug":"dream-skin-source-image-exceeds-50-mib","errorCode":null,"errorMessage":"Dream Skin source image exceeds 50 MiB","messagePattern":"Dream Skin source image exceeds 50 MiB","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin.rs","lineNumber":60,"sourceCode":"    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()\n        )\n    })?;\n    if prepared_metadata.len() == 0 {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin.rs#L42-L78","documentation":"After confirming the source is a regular file, the same guard checks metadata.len() against a 50 MiB cap and bails when the Dream Skin source image exceeds it. It protects config directories and UI loading from oversized payloads; empty files are rejected just before this check.","triggerScenarios":"import_dream_skin_image receives a source image whose metadata.len() exceeds 50 MiB, checked in prepare_dream_skin_image_for_directory.","commonSituations":"Importing raw camera photos, multi-megabyte PNG screenshots at 5K resolution, or uncompressed TIFF/BMP files exported from editors.","solutions":["Downscale or re-encode the image (resize to screen resolution, convert to PNG/JPEG/WebP) to get under 50 MiB.","Strip metadata (EXIF) with a tool like ImageMagick ('magick input.png -strip output.png') to reduce size.","If the use case legitimately needs bigger sources, raise DREAM_SKIN_SOURCE_LIMIT in dream_skin.rs and rebuild."],"exampleFix":"// shell preparation before import\n// before: importing 80 MiB raw.png\nmagick raw.png -resize 3840x2160 -strip theme.png  # after: well under 50 MiB\nimport_dream_skin_image(\"theme.png\", dir, stem)?;","handlingStrategy":"validation","validationCode":"const DREAM_SKIN_SOURCE_LIMIT: u64 = 50 * 1024 * 1024;\nlet md = std::fs::metadata(&source)?;\nif md.len() > DREAM_SKIN_SOURCE_LIMIT {\n    eprintln!(\"image too large ({} bytes); downscale before import\", md.len());\n    return Ok(()); // or run an automatic resize\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compress/rescale wallpapers to display resolution before import","Strip EXIF/metadata from exported images","Show a file-size warning in the UI before invoking the import"],"tags":["filesystem","size-limit","validation"],"backgroundTag":"payload-too-large","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}