BigPizzaV3/CodexPlusPlus · error
Dream Skin theme must contain exactly one image
Error message
Dream Skin theme must contain exactly one image
What it means
Thrown by load_stored_dream_skin_theme when the theme directory on disk contains no image file matching the expected extensions. A stored theme must have exactly one image next to its theme.json config; find_theme_image returned None so the stored theme is incomplete or corrupt.
Solutions
- Restore the image file into the theme directory with its original name and extension
- Recreate the theme from the source image via create_dream_skin_theme_from_image
- Delete the broken theme entry and re-add it through the app UI
Defensive patterns
Strategy: validation
Validate before calling
if !theme_dir.join("theme.json").exists() {
return Err("theme.json missing".into());
}
let has_image = std::fs::read_dir(&theme_dir)?
.filter_map(Result::ok)
.any(|e| {
e.path().extension()
.and_then(|x| x.to_str())
.map(|x| matches!(x.to_ascii_lowercase().as_str(), "png"|"jpg"|"jpeg"|"heic"|"tif"|"tiff"|"webp"))
.unwrap_or(false)
});
if !has_image { return Err("theme directory has no image".into()); } Try / catch
match load_stored_dream_skin_theme(&dir, &id) {
Err(e) if e.to_string().contains("must contain exactly one image") => {
// treat as corrupt theme: offer re-import UI
}
other => other?,
} Prevention
- Never manually delete or rename files inside stored theme directories
- Use the app's delete/re-import flows instead of filesystem cleanup tools
- When backing up themes, copy the entire directory including the image
When it happens
Trigger: Loading/renaming/deleting a stored theme whose image file was manually deleted, renamed with an unsupported extension, or never written by save_validated_dream_skin_package.
Common situations: User manually cleaned the theme directory and removed the image; backup/restore tooling copied only theme.json; a partial write left the directory without the image; the image was renamed to an extension find_theme_image does not scan.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- built-in Dream Skin theme cannot be deleted
- built-in Dream Skin theme is read-only
- Codex CLI 路径指向的是目录而不是可执行文件:
- Codex CLI 没有执行权限:
- Codex CLI 路径不存在: 请填 Codex CLI 可执行文件的完整路径。macOS 桌面版通常在…
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/cef43783cf54d8d3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_library.rs:393
.with_context(|| format!("Dream Skin theme not found: {id}"))?;
if !metadata.file_type().is_dir() || metadata.file_type().is_symlink() {
bail!("Dream Skin theme path is not a safe directory");
}
let config_path = directory.join(THEME_CONFIG_FILE);
let metadata = std::fs::symlink_metadata(&config_path)
.with_context(|| format!("Dream Skin theme config not found: {id}"))?;
if !metadata.file_type().is_file()
|| metadata.file_type().is_symlink()
|| metadata.len() > THEME_CONFIG_LIMIT
{
bail!("invalid Dream Skin theme config");
}
let config: DreamSkinThemeConfig = serde_json::from_slice(&std::fs::read(&config_path)?)?;
if config.id != id {
bail!("Dream Skin theme id does not match directory");
}
let image = find_theme_image(&directory)
.ok_or_else(|| anyhow::anyhow!("Dream Skin theme must contain exactly one image"))?;
let draft = DreamSkinThemeDraft {
config,
image_path: image.to_string_lossy().into_owned(),
builtin: false,
};
validate_theme_draft(&draft)?;
Ok(draft)
}
pub fn rename_dream_skin_theme(
state_dir: &Path,
id: &str,
name: &str,
) -> anyhow::Result<DreamSkinThemeSummary> {
let mut draft = load_stored_dream_skin_theme(state_dir, id)?;
draft.config.name = name.trim().to_string();
save_dream_skin_theme(state_dir, &draft)
}View on GitHub (pinned to b1ed92e5e4)