BigPizzaV3/CodexPlusPlus · error

unsupported Dream Skin backup schema

Error message

unsupported Dream Skin backup schema

What it means

parse_backup_item deserializes a single backed-up TOML value according to the backup file's schema_version: 1 uses the legacy parser and the current BACKUP_SCHEMA_VERSION uses the document parser. Any other version number hits the catch-all bail!. It is an internal guard: the schema should already have been validated by read_backup, so reaching this arm implies a backup struct was constructed or mutated in code rather than read through read_backup.

Solutions

  1. Ensure every backup is loaded via read_backup (or re-serialize/deserialize it through it) so unsupported versions are rejected before reaching the item parsers.
  2. Regenerate the backup: disable then re-enable the Dream Skin theme against the correct home so a fresh backup with the current BACKUP_SCHEMA_VERSION is written.
  3. If you construct DreamSkinThemeBackup in tests/tools, set schema_version to 1 or the crate's BACKUP_SCHEMA_VERSION constant.
  4. If this fires after a version upgrade, isolate/remove the old backup file and let the library create a new one.

Example fix

// before
let backup = DreamSkinThemeBackup { schema_version: 7, .. };
restore_backup_setting(desktop, &backup, "appearanceTheme")?; // bails
// after
let bytes = std::fs::read(&backup_path)?;
let backup: DreamSkinThemeBackup = serde_json::from_slice(&bytes)?;
assert!(matches!(backup.schema_version, 1 | BACKUP_SCHEMA_VERSION));
restore_backup_setting(desktop, &backup, "appearanceTheme")?;
Defensive patterns

Strategy: type-guard

Validate before calling

fn supports_backup(backup: &DreamSkinThemeBackup) -> bool {
    matches!(backup.schema_version, 1 | BACKUP_SCHEMA_VERSION)
}

Type guard

fn is_supported_schema(v: u32) -> bool {
    v == 1 || v == BACKUP_SCHEMA_VERSION
}

Try / catch

match restore_backup_setting(desktop, &backup, key) {
    Ok(()) => {},
    Err(e) if e.to_string().contains("unsupported Dream Skin backup schema") => {
        // backup struct bypassed read_backup; reload via read_backup or regenerate
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling restore_base_theme or restore_backup_setting with a DreamSkinThemeBackup whose schema_version is neither 1 nor BACKUP_SCHEMA_VERSION. Since both callers obtain the backup via read_backup (which pre-validates the same versions), this fires only when the struct bypasses read_backup — e.g. a test or new code path builds DreamSkinThemeBackup directly, or a future code path deserializes the JSON without the read_backup gate and a schema bump leaves an older writer.

Common situations: Upgrading the library after BACKUP_SCHEMA_VERSION changed while hand-crafted or cached backup structs are reused in-process; writing custom tooling/tests that construct DreamSkinThemeBackup with an invented schema_version; a partially migrated code path that skips read_backup.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/4ac8c8c5902c3d18. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin.rs:491

    theme.insert("fonts", Value::InlineTable(fonts));
    theme.insert("ink", profile.ink.into());
    theme.insert("opaqueWindows", profile.opaque_windows.into());
    theme.insert("semanticColors", Value::InlineTable(semantic_colors));
    theme.insert("surface", profile.surface.into());
    theme
}

fn serialize_item(item: &Item) -> String {
    let mut document = DocumentMut::new();
    document["value"] = item.clone();
    document.to_string()
}

fn parse_backup_item(backup: &DreamSkinThemeBackup, serialized: &str) -> anyhow::Result<Item> {
    match backup.schema_version {
        1 => parse_legacy_item(serialized),
        BACKUP_SCHEMA_VERSION => parse_document_item(serialized),
        _ => bail!("unsupported Dream Skin backup schema"),
    }
}

fn parse_legacy_item(serialized: &str) -> anyhow::Result<Item> {
    match format!("value = {serialized}\n").parse::<DocumentMut>() {
        Ok(mut document) => document
            .remove("value")
            .context("serialized Dream Skin backup value is missing"),
        Err(_) => parse_legacy_table(serialized),
    }
}

fn parse_legacy_table(serialized: &str) -> anyhow::Result<Item> {
    let document = serialized.parse::<DocumentMut>()?;
    Ok(Item::Table(document.as_table().clone()))
}

fn parse_document_item(serialized: &str) -> anyhow::Result<Item> {

View on GitHub (pinned to b1ed92e5e4)