{"record":{"id":"67b744e1933841b2","repo":"Hmbown/CodeWhale","slug":"could-not-release-root-config-policy-err-rollb","errorCode":null,"errorMessage":"could not release root config policy ({err}){rollback_note}","messagePattern":"could not release root config policy \\((.+?)\\)(.+?)","errorType":"console","errorClass":"RootPostureOutcome::Failed","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/app.rs","lineNumber":3600,"sourceCode":"            settings.permission_posture = Some(posture);\n            if let Err(err) = transaction.save(&settings) {\n                return Ok(RootPostureOutcome::Failed(format!(\n                    \"could not save TUI posture ({err})\"\n                )));\n            }\n\n            if let Err(err) = crate::config_persistence::persist_unset_root_key(\n                active_config_path.as_deref(),\n                \"approval_policy\",\n            ) {\n                settings.permission_posture = previous;\n                let rollback_note = transaction\n                    .save(&settings)\n                    .err()\n                    .map(|rollback| format!(\"; settings rollback also failed: {rollback}\"))\n                    .unwrap_or_default();\n                return Ok(RootPostureOutcome::Failed(format!(\n                    \"could not release root config policy ({err}){rollback_note}\"\n                )));\n            }\n            Ok(RootPostureOutcome::Committed)\n        })\n        .unwrap_or_else(|err| {\n            RootPostureOutcome::Failed(format!(\"could not lock TUI settings ({err})\"))\n        });\n        if let RootPostureOutcome::Failed(reason) = outcome {\n            return Err(reason);\n        }\n\n        self.clear_saved_approval_policy_lock();\n        self.finish_approval_posture_change(next);\n        Ok(())\n    }\n\n    fn next_approval_posture(&mut self, allow_root_policy: bool) -> Option<ApprovalMode> {\n        if self.reject_setting_change_while_busy(MessageId::SettingSubjectPermissions) {","sourceCodeStart":3582,"sourceCodeEnd":3618,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/app.rs#L3582-L3618","documentation":"While changing the root config posture (e.g. granting/revoking root-config policy in settings), the commit step that releases the previous root config policy failed (`err`). The transaction then attempted to roll back the settings file with `transaction.save(&settings)`, and any secondary rollback failure is appended as `rollback_note`. The whole operation reports as RootPostureOutcome::Failed.","triggerScenarios":"The root-posture transaction in tui/app.rs fails at the policy-release step (settings lock/apply error), and `transaction.save(&settings)` is invoked as rollback; the error surfaces whether or not the rollback itself also fails.","commonSituations":"The settings file is read-only or locked by another Codewhale instance; the settings file was hand-edited into a state the transaction cannot write back; disk-full during the transaction; a policy referenced in settings no longer exists.","solutions":["Read the wrapped `err` (and any rollback note) to see whether the release or the rollback failed.","Close other Codewhale instances or editors holding the settings file and retry the posture change.","Fix settings file permissions or free disk space as indicated by the chained errors.","Inspect/repair the settings file manually if the rollback note shows it was left in a bad state.","Retry the root posture operation after the environment issue is resolved."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before a posture change, ensure the settings file is writable and not locked\nlet md = std::fs::metadata(&settings_path)?;\nif md.permissions().readonly() {\n    anyhow::bail!(\"settings file read-only; posture transaction would fail\");\n}","typeGuard":null,"tryCatchPattern":"// Rust\nmatch apply_root_posture(transaction).await {\n    RootPostureOutcome::Failed(msg) if msg.starts_with(\"could not release root config policy\") => {\n        // parse rollback note; close competing writers; repair settings; retry\n    }\n    other => { /* handle committed/locked outcomes */ }\n}","preventionTips":["Close other Codewhale instances before changing root posture.","Keep the settings file writable and out of sync tools that may lock it.","Never hand-edit settings while a transaction is in flight.","Maintain disk headroom so transaction writes cannot fail."],"tags":["settings","transaction","policy","rollback"],"backgroundTag":"file-write-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}