Hmbown/CodeWhale · critical

; runtime preset rollback also failed

Error message

{error:#}; runtime preset rollback also failed: {rollback_errors}

What it means

Produced by runtime_preset_error_with_rollback when applying a runtime preset failed AND attempting to restore the prior snapshots also failed. The original error is preserved as the prefix and each rollback failure is appended, so the developer sees both the cause and the collateral damage. If rollback succeeds, only the original error propagates.

Solutions

  1. Read the original error prefix first and fix the preset application failure
  2. Inspect each appended rollback error and manually restore the affected runtime settings
  3. Retry applying the preset after state is consistent; avoid concurrent config edits during setup
Defensive patterns

Strategy: try-catch

Try / catch

match apply_setup_runtime_preset(...) {
    Err(e) => {
        eprintln!("preset failed: {e:#}");
        // manually verify runtime settings match the previous preset
    }
    Ok(_) => {}
}

Prevention

When it happens

Trigger: apply_setup_runtime_preset hits any error, then one or more snapshot.restore() calls error while rolling back to the previous runtime state.

Common situations: Preset references an invalid provider/model while the previous snapshots hold stale or locked runtime state; concurrent config mutation during setup; partial preset application left snapshots unrestorable.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/12e3584aa4e05cfe. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tui/ui/provider_setup.rs:76

                }
            },
        }
    }
}

pub(crate) fn runtime_preset_error_with_rollback(
    error: anyhow::Error,
    snapshots: &[&RuntimePresetFileSnapshot],
) -> anyhow::Error {
    let rollback_errors = snapshots
        .iter()
        .filter_map(|snapshot| snapshot.restore().err())
        .map(|error| format!("{error:#}"))
        .collect::<Vec<_>>();
    if rollback_errors.is_empty() {
        error
    } else {
        anyhow::anyhow!(
            "{error:#}; runtime preset rollback also failed: {}",
            rollback_errors.join("; ")
        )
    }
}

View on GitHub (pinned to 433685b202)