BigPizzaV3/CodexPlusPlus · error
built-in Dream Skin theme cannot be deleted
Error message
built-in Dream Skin theme cannot be deleted
What it means
Before removing the directory, delete_dream_skin_theme loads the stored theme and compares its config.id against DreamSkinThemeConfig::default().id (the built-in theme's id). Built-in themes ship with the app and cannot be deleted. The error is a deliberate protection of first-party/default themes.
Solutions
- Skip the built-in theme in your delete loop (compare id against the built-in/default id) rather than treating it as an error.
- If you want a different look, create a new custom theme and switch to it instead of deleting the built-in one.
- If a custom theme wrongly carries the default id (bug during creation), recreate it via save_dream_skin_theme with a proper unique id, then delete the original non-builtin copy or fix its theme.json id manually.
Example fix
// before
for theme in themes {
delete_dream_skin_theme(&state_dir, &theme.config.id, Some(&active_id))?; // hits built-in
}
// after
const BUILTIN_ID: &str = DreamSkinThemeConfig::default().id.as_str();
for theme in themes.filter(|t| t.config.id != BUILTIN_ID) {
delete_dream_skin_theme(&state_dir, &theme.config.id, Some(&active_id))?;
} Defensive patterns
Strategy: validation
Validate before calling
let builtin_id = DreamSkinThemeConfig::default().id;
if id == builtin_id { return; } // skip built-in in delete flows Try / catch
match delete_dream_skin_theme(&state_dir, &id, active) {
Err(e) if e.to_string().contains("built-in") => { /* skip, expected for default theme */ }
other => other?,
} Prevention
- Filter out the built-in id in any 'delete all themes' loop.
- Offer 'reset to default' instead of delete for the built-in theme.
- Ensure custom themes get unique non-default ids at creation time.
When it happens
Trigger: Calling delete_dream_skin_theme(state_dir, id, active_id) where id resolves to a stored theme whose config.json contains the default/built-in id (the id of a fresh DreamSkinThemeConfig::default()).
Common situations: Attempting to clean up the default theme created on first run; batch-delete of all themes in the library; a theme saved earlier with the default id because the draft's id was never set from the default config.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- built-in Dream Skin theme is read-only
- current Dream Skin theme cannot be deleted
- Dream Skin theme name is empty
- Dream Skin theme must contain exactly one image
- 无效的主题市场相对路径
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/2b15cfee1cea1042.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_library.rs:505
state_dir: &Path,
id: &str,
active_id: Option<&str>,
) -> anyhow::Result<()> {
if !valid_theme_id(id) {
bail!("invalid Dream Skin theme id");
}
if active_id.is_some_and(|active| active == id) {
bail!("current Dream Skin theme cannot be deleted");
}
let directory = state_dir.join(THEMES_DIR).join(id);
let metadata = std::fs::symlink_metadata(&directory)
.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 stored = load_stored_dream_skin_theme(state_dir, id)?;
if stored.config.id == DreamSkinThemeConfig::default().id {
bail!("built-in Dream Skin theme cannot be deleted");
}
remove_known_theme_directory(&directory)
}
fn validate_theme_draft(draft: &DreamSkinThemeDraft) -> anyhow::Result<()> {
if draft.builtin {
bail!("built-in Dream Skin theme is read-only");
}
if !valid_theme_id(&draft.config.id) {
bail!("invalid Dream Skin theme id");
}
if draft.config.schema_version != 1 {
bail!("unsupported Dream Skin theme schema");
}
if draft.config.name.trim().is_empty() {
bail!("Dream Skin theme name is empty");
}
if !draft.config.style_preset.is_empty() && !valid_theme_id(&draft.config.style_preset) {View on GitHub (pinned to b1ed92e5e4)