Hmbown/CodeWhale · error

unsupported permission posture

Error message

unsupported permission posture {value:?}; expected ask, auto-review, or full-access

What it means

from_request validates the optional permission_posture string via ApprovalMode::from_config_value; an unrecognized value raises this error listing the accepted postures (ask, auto-review, full-access). It only fires when a posture string was supplied — the None case falls back to legacy YOLO alias or Suggest instead of erroring.

Solutions

  1. Send permission_posture as exactly one of: ask, auto-review, full-access.
  2. Omit permission_posture entirely to use the legacy alias/auto_approve/Suggest defaults.
  3. Check ApprovalMode::from_config_value for the accepted config spellings.
  4. Omit permission_posture entirely to use the legacy alias/auto_approve/Suggest defaults.

Example fix

// before
{"mode": "act", "permission_posture": "auto"}

// after
{"mode": "act", "permission_posture": "auto-review"}
Defensive patterns

Strategy: validation

Validate before calling

const POSTURES: [&str; 3] = ["ask", "auto-review", "full-access"];
fn valid_posture(p: &str) -> bool {
    POSTURES.contains(&p)
}

Type guard

fn as_permission_posture(s: &str) -> Option<&'static str> {
    match s {
        "ask" => Some("ask"),
        "auto-review" => Some("auto-review"),
        "full-access" => Some("full-access"),
        _ => None,
    }
}

Try / catch

match err.to_string().contains("unsupported permission posture") {
    true => eprintln!("use posture: ask | auto-review | full-access, or omit it"),
    false => propagate(err),
}

Prevention

When it happens

Trigger: Calling RuntimePolicy::from_request with permission_posture = Some(value) where value does not map to an ApprovalMode, e.g. "auto" or "yolo" instead of the three supported postures.

Common situations: Clients upgrading from an older permission vocabulary, hand-written request payloads guessing at posture names, or config files exporting posture values that no longer match the ApprovalMode config keys.

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@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/511047dbb5a50cd0. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/runtime_policy.rs:72

        Self {
            mode: parsed_mode,
            permission,
        }
    }

    /// Validate and normalize a new Runtime request. Legacy aliases are
    /// accepted as one-way inputs, but only current values are persisted.
    pub(crate) fn from_request(
        mode: &str,
        permission_posture: Option<&str>,
        auto_approve: Option<bool>,
    ) -> Result<Self> {
        let parsed_mode = parse_runtime_mode(mode).ok_or_else(|| {
            anyhow::anyhow!("unsupported Runtime mode {mode:?}; expected plan, act, or operate")
        })?;
        let permission = match permission_posture {
            Some(value) => ApprovalMode::from_config_value(value).ok_or_else(|| {
                anyhow::anyhow!(
                    "unsupported permission posture {value:?}; expected ask, auto-review, or full-access"
                )
            })?,
            None if legacy_yolo_alias(mode) || auto_approve.unwrap_or(false) => ApprovalMode::Bypass,
            None => ApprovalMode::Suggest,
        };
        if permission == ApprovalMode::Never {
            bail!("permission posture 'never' is not part of the Runtime product contract");
        }
        Ok(Self {
            mode: parsed_mode,
            permission,
        })
    }

    #[must_use]
    pub(crate) fn mode_setting(self) -> &'static str {
        self.mode.as_setting()

View on GitHub (pinned to 73e0f67d83)