BigPizzaV3/CodexPlusPlus · error
built-in Dream Skin theme is read-only
Error message
built-in Dream Skin theme is read-only
What it means
validate_theme_draft rejects any draft whose `builtin` flag is true: built-in themes are shipped/read-only and may never be re-saved or modified through the write path. The flag travels with the draft, so this fires for any mutating entry point (save, package import, activation prep) that received a builtin draft.
Solutions
- Clone the built-in theme into a new draft with builtin=false and a fresh unique id, edit that, and save the copy.
- When deriving from an existing draft, explicitly set draft.builtin = false after copying.
- If editing built-ins is genuinely needed, modify the theme's theme.json on disk outside this API or ship a new built-in in the app's default list.
Example fix
// before let mut draft = load_stored_dream_skin_theme(&state_dir, "midnight")?.draft; draft.config.colors = Some(new_colors); save_dream_skin_theme(&state_dir, &draft)?; // builtin=true -> error // after let mut draft = load_stored_dream_skin_theme(&state_dir, "midnight")?.draft; draft.config.id = "midnight-custom".into(); draft.config.name = "Midnight Custom".into(); draft.builtin = false; draft.config.colors = Some(new_colors); save_dream_skin_theme(&state_dir, &draft)?;
Defensive patterns
Strategy: validation
Validate before calling
if draft.builtin {
// clone instead of save
let mut copy = draft.clone();
copy.builtin = false;
copy.config.id = format!("{}-copy", draft.config.id);
} Type guard
fn is_editable(draft: &DreamSkinThemeDraft) -> bool { !draft.builtin } Try / catch
if let Err(e) = save_dream_skin_theme(&state_dir, &draft) {
if e.to_string().contains("read-only") {
// fall back to save-as-copy flow
} else { return Err(e); }
} Prevention
- Treat builtin=true drafts as immutable; always duplicate before editing.
- In UI, show 'duplicate' not 'save' for built-in themes.
- Reset builtin=false and assign a new id when importing packages derived from built-ins.
When it happens
Trigger: Calling save_dream_skin_theme with a draft loaded from a built-in theme (builtin=true); importing a package containing a theme marked builtin; calling prepare_dream_skin_activation or load_stored_dream_skin_theme with a builtin-flagged draft that then goes through validation.
Common situations: Loading a built-in theme, tweaking colors, and re-saving it; copy-pasting a builtin draft and forgetting to set builtin=false; import tooling that preserves the builtin flag from a package manifest.
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 cannot be deleted
- 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/4df885d17340e8b3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_library.rs:512
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) {
bail!("invalid Dream Skin style preset");
}
if let Some(colors) = &draft.config.colors {
for color in [
&colors.background,
&colors.panel,
&colors.panel_alt,View on GitHub (pinned to b1ed92e5e4)