{"record":{"id":"94c66d7f5c0bae93","repo":"BigPizzaV3/CodexPlusPlus","slug":"invalid-dream-skin-style-preset","errorCode":null,"errorMessage":"invalid Dream Skin style preset","messagePattern":"invalid Dream Skin style preset","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":524,"sourceCode":"    }\n    remove_known_theme_directory(&directory)\n}\n\nfn validate_theme_draft(draft: &DreamSkinThemeDraft) -> anyhow::Result<()> {\n    if draft.builtin {\n        bail!(\"built-in Dream Skin theme is read-only\");\n    }\n    if !valid_theme_id(&draft.config.id) {\n        bail!(\"invalid Dream Skin theme id\");\n    }\n    if draft.config.schema_version != 1 {\n        bail!(\"unsupported Dream Skin theme schema\");\n    }\n    if draft.config.name.trim().is_empty() {\n        bail!(\"Dream Skin theme name is empty\");\n    }\n    if !draft.config.style_preset.is_empty() && !valid_theme_id(&draft.config.style_preset) {\n        bail!(\"invalid Dream Skin style preset\");\n    }\n    if let Some(colors) = &draft.config.colors {\n        for color in [\n            &colors.background,\n            &colors.panel,\n            &colors.panel_alt,\n            &colors.accent,\n            &colors.accent_alt,\n            &colors.secondary,\n            &colors.highlight,\n            &colors.text,\n            &colors.muted,\n            &colors.line,\n        ] {\n            if !valid_css_color(color) {\n                bail!(\"invalid Dream Skin theme color: {color}\");\n            }\n        }","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_library.rs#L506-L542","documentation":"validate_theme_draft optionally checks draft.config.style_preset: if the field is non-empty it must itself pass valid_theme_id (1-64 bytes, alphanumeric start, [a-z0-9._-] only). The preset is the identifier of a base style the theme builds on, so a malformed preset id is rejected before saving. An empty string means 'no preset' and is allowed.","triggerScenarios":"Saving a draft whose style_preset is non-empty but malformed — uppercase (\"Midnight\"), spaces, >64 chars, leading '-', or containing '/' — while empty string passes fine.","commonSituations":"Typing a preset's display name instead of its slug id; importing packages whose preset references a foreign naming convention; a preset id referencing a theme that was renamed or removed, then re-saved after hand-editing.","solutions":["Set style_preset to a valid slug id (lowercase [a-z0-9._-], <=64 bytes) of an existing preset, or leave it empty (\"\") for no preset.","Slugify the value the same way as theme ids before assigning it.","Verify the referenced preset actually exists in the library to avoid a saved theme pointing at a nonexistent style."],"exampleFix":"// before\nconfig.style_preset = \"Midnight Blue\".into(); // invalid: uppercase + space\nsave_dream_skin_theme(&state_dir, &draft(config))?;\n// after\nconfig.style_preset = \"midnight\".into(); // valid preset id, or \"\" for none\nsave_dream_skin_theme(&state_dir, &draft(config))?;","handlingStrategy":"validation","validationCode":"if !draft.config.style_preset.is_empty() && !is_valid_theme_id(&draft.config.style_preset) {\n    draft.config.style_preset.clear(); // or fix to a known preset slug\n}","typeGuard":"fn has_valid_preset(c: &DreamSkinThemeConfig) -> bool {\n    c.style_preset.is_empty() || is_valid_theme_id(&c.style_preset)\n}","tryCatchPattern":null,"preventionTips":["Select presets from a dropdown of existing preset ids, never free text.","Treat empty string as the 'none' sentinel.","Validate referenced presets exist in the library before saving."],"tags":["validation","style-preset","identifier-format","rust"],"backgroundTag":"invalid-argument-value","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"}