Hmbown/CodeWhale · error

agent profile may not disable approval_required

Error message

agent profile {} may not disable approval_required

What it means

Agent profiles may not disable the approval requirement. approval_required is only meaningful when true; setting it to false in an agent profile is treated as permission expansion and rejected at load time.

Solutions

  1. Remove the approval_required key or set it to true in the agent profile
  2. Configure unattended/approval-free operation via FleetProfile policy if legitimately needed
  3. Keep the agent profile restrictive and rely on the workspace policy for grants

Example fix

// before
[permissions]
approval_required = false

// after
[permissions]
approval_required = true
Defensive patterns

Strategy: validation

Validate before calling

let approval_off = profile.get("permissions").and_then(|p| p.get("approval_required")) == Some(&toml::Value::Boolean(false));
if approval_off {
    eprintln!("agent profile may not set approval_required=false");
}

Try / catch

match result {
    Err(e) if e.to_string().contains("approval_required") => {
        eprintln!("keep approval_required true or remove the key in agent profiles");
    }
    other => other?,
}

Prevention

When it happens

Trigger: An agent profile TOML containing `[permissions] approval_required = false` parsed by agent_profile_from_toml; absent or true values pass the guard.

Common situations: Copying a permissive workspace permissions block into an agent profile; trying to make an agent run unattended by disabling approvals in its profile instead of at policy level; stale example configs from before the guard existed.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/99dbedc06b97a5ed. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/fleet/profile.rs:513

            ),
        }
    }

    if let Some(permissions) = permissions {
        if permissions.allow_shell.unwrap_or(false) {
            bail!(
                "agent profile {} may not request allow_shell=true",
                path.display()
            );
        }
        if permissions.trust.unwrap_or(false) {
            bail!(
                "agent profile {} may not request trust=true",
                path.display()
            );
        }
        if permissions.approval_required == Some(false) {
            bail!(
                "agent profile {} may not disable approval_required",
                path.display()
            );
        }
    }
    Ok(())
}

fn validate_agent_profile_token(path: &Path, field: &str, value: &str) -> Result<()> {
    let trimmed = value.trim();
    if trimmed.is_empty() {
        bail!("agent profile {} {field} cannot be empty", path.display());
    }
    if trimmed != value || !trimmed.chars().all(is_agent_profile_token_char) {
        bail!(
            "agent profile {} {field} must be a simple token",
            path.display()
        );

View on GitHub (pinned to 73e0f67d83)