Hmbown/CodeWhale · error

could not release root config policy ({err}){rollback_note}

Error message

could not release root config policy ({err}){rollback_note}

What it means

In the root approval-posture flow, after saving the new posture and unsetting the root approval_policy key, a failure to release the old root config policy triggers rollback: permission_posture is restored and the transaction re-saved. The Failed outcome string carries the release error plus a rollback_note recording whether the rollback itself succeeded — it is a reported outcome for the UI, not a panic.

Source

Thrown at crates/tui/src/tui/app.rs:2964

            settings.permission_posture = Some(posture);
            if let Err(err) = transaction.save(&settings) {
                return Ok(RootPostureOutcome::Failed(format!(
                    "could not save TUI posture ({err})"
                )));
            }

            if let Err(err) = crate::config_persistence::persist_unset_root_key(
                active_config_path.as_deref(),
                "approval_policy",
            ) {
                settings.permission_posture = previous;
                let rollback_note = transaction
                    .save(&settings)
                    .err()
                    .map(|rollback| format!("; settings rollback also failed: {rollback}"))
                    .unwrap_or_default();
                return Ok(RootPostureOutcome::Failed(format!(
                    "could not release root config policy ({err}){rollback_note}"
                )));
            }
            Ok(RootPostureOutcome::Committed)
        })
        .unwrap_or_else(|err| {
            RootPostureOutcome::Failed(format!("could not lock TUI settings ({err})"))
        });
        if let RootPostureOutcome::Failed(reason) = outcome {
            return Err(reason);
        }

        self.clear_saved_approval_policy_lock();
        self.finish_approval_posture_change(next);
        Ok(())
    }

    fn next_approval_posture(&mut self, allow_root_policy: bool) -> Option<ApprovalMode> {
        if self.reject_setting_change_while_busy(MessageId::SettingSubjectPermissions) {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Read the outcome message plus rollback_note to see both the release failure and whether settings were restored
  2. Re-run the posture change after fixing config file permissions or locks
  3. If rollback also failed, manually restore permission_posture in settings before retrying
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/tui/src/tui/app.rs:2964 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/67b744e1933841b2. Report an issue: GitHub.