{"record":{"id":"12e3584aa4e05cfe","repo":"Hmbown/CodeWhale","slug":"error-runtime-preset-rollback-also-failed-rollback-errors","errorCode":null,"errorMessage":"{error:#}; runtime preset rollback also failed: {rollback_errors}","messagePattern":"(.+?); runtime preset rollback also failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/tui/src/tui/ui/provider_setup.rs","lineNumber":76,"sourceCode":"                }\n            },\n        }\n    }\n}\n\npub(crate) fn runtime_preset_error_with_rollback(\n    error: anyhow::Error,\n    snapshots: &[&RuntimePresetFileSnapshot],\n) -> anyhow::Error {\n    let rollback_errors = snapshots\n        .iter()\n        .filter_map(|snapshot| snapshot.restore().err())\n        .map(|error| format!(\"{error:#}\"))\n        .collect::<Vec<_>>();\n    if rollback_errors.is_empty() {\n        error\n    } else {\n        anyhow::anyhow!(\n            \"{error:#}; runtime preset rollback also failed: {}\",\n            rollback_errors.join(\"; \")\n        )\n    }\n}\n","sourceCodeStart":58,"sourceCodeEnd":82,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/tui/ui/provider_setup.rs#L58-L82","documentation":"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.","triggerScenarios":"apply_setup_runtime_preset hits any error, then one or more snapshot.restore() calls error while rolling back to the previous runtime state.","commonSituations":"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.","solutions":["Read the original error prefix first and fix the preset application failure","Inspect each appended rollback error and manually restore the affected runtime settings","Retry applying the preset after state is consistent; avoid concurrent config edits during setup"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match apply_setup_runtime_preset(...) {\n    Err(e) => {\n        eprintln!(\"preset failed: {e:#}\");\n        // manually verify runtime settings match the previous preset\n    }\n    Ok(_) => {}\n}","preventionTips":["Validate preset values before applying","Avoid concurrent config edits during preset application","Snapshot runtime state yourself before applying complex presets"],"tags":["preset","rollback","config"],"backgroundTag":"invalid-config-value","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}