Hmbown/CodeWhale · error

Invalid auto_review.

Error message

Invalid auto_review.{kind}[{index}].action_kind '{action_kind}': expected read, write, shell, external, publish, or destructive.

What it means

Auto-review `action_kind` values are normalized (trimmed, lowercased, hyphens to underscores) and parsed against the known set. If the value does not parse, validation fails listing the accepted kinds: read, write, shell, external, publish, or destructive. Thrown at config.rs:3468.

Solutions

  1. Replace the action_kind with one of: read, write, shell, external, publish, destructive.
  2. Use an exact `tool` rule instead if no action_kind fits.
  3. Normalization accepts case-insensitive and hyphenated input (e.g. "Read" or "read" are fine), so only the vocabulary itself is wrong.

Example fix

// before
action_kind = "network"
// after
action_kind = "external"
Defensive patterns

Strategy: validation

Validate before calling

const KINDS: [&str; 6] = ["read","write","shell","external","publish","destructive"];
if let Some(k) = &rule.action_kind {
    let norm = k.trim().to_ascii_lowercase().replace('-', "_");
    if !KINDS.contains(&norm.as_str()) {
        return Err(format!("action_kind '{k}' not in {KINDS:?}"));
    }
}

Prevention

When it happens

Trigger: A rule's `action_kind` string, after trim/lowercase/underscore normalization, is not recognized by parse_auto_review_action_kind — e.g. action_kind = "network" or "exec".

Common situations: Typos like action_kind = "writte"; inventing kinds like "network" or "git"; carrying over kinds from a pre-v0.9.8 config that used a different taxonomy.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/config.rs:3468

    for (index, rule) in rules.iter().enumerate() {
        if rule
            .text_contains
            .as_deref()
            .is_some_and(|value| !value.trim().is_empty())
        {
            anyhow::bail!(
                "Invalid auto_review.{kind}[{index}].text_contains: user-intent matching was retired; scope the rule with tool and/or action_kind."
            );
        }
        if !rule.has_matcher() {
            anyhow::bail!(
                "Invalid auto_review.{kind}[{index}]: set at least one of tool or action_kind."
            );
        }
        if let Some(action_kind) = rule.action_kind.as_deref() {
            let normalized = action_kind.trim().to_ascii_lowercase().replace('-', "_");
            if parse_auto_review_action_kind(&normalized).is_none() {
                anyhow::bail!(
                    "Invalid auto_review.{kind}[{index}].action_kind '{action_kind}': expected read, write, shell, external, publish, or destructive."
                );
            }
            if kind == "allow"
                && !matches!(
                    normalized.as_str(),
                    "read" | "write" | "shell" | "external" | "publish" | "destructive"
                )
            {
                anyhow::bail!(
                    "Invalid auto_review.allow[{index}].action_kind '{action_kind}': this retired narrow kind cannot safely widen to a v0.9.8 decision class; replace it with an exact tool rule or a current action_kind."
                );
            }
        }
    }
    Ok(())
}

View on GitHub (pinned to 73e0f67d83)