Hmbown/CodeWhale · error

Invalid auto_review.

Error message

Invalid auto_review.{kind}[{index}]: set at least one of tool or action_kind.

What it means

Auto-review rule validation requires every rule to carry at least one matcher: `tool` or `action_kind`. A rule with neither (and no accepted text_contains) would match everything, which is treated as a config error. Thrown during config validation in the rule loop at config.rs:3461.

Solutions

  1. Set `tool` to the exact tool name the rule targets (e.g. tool = "shell").
  2. Or set `action_kind` to one of read, write, shell, external, publish, destructive.
  3. Remove the rule entirely if it was a placeholder.

Example fix

// before
[[auto_review.allow]]
# nothing set
// after
[[auto_review.allow]]
tool = "read_file"
Defensive patterns

Strategy: validation

Validate before calling

if rule.tool.is_none() && rule.action_kind.is_none() {
    return Err("auto_review rule needs at least one of tool or action_kind");
}

Prevention

When it happens

Trigger: An `auto_review.{kind}` rule entry (allow or deny) is present in config but has an empty/absent `tool` and `action_kind` (and text_contains is empty or retired), so `rule.has_matcher()` returns false.

Common situations: Adding an empty `[[auto_review.allow]]` table placeholder; a commented-out or typo'd matcher key (e.g. `actions_kind`) leaving the rule with no matchers; TOML tools emitting an empty table for a rule.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

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

                .action_kind
                .as_deref()
                .is_some_and(|value| !value.trim().is_empty())
    }
}

fn validate_auto_review_rules(kind: &str, rules: &[AutoReviewRuleConfig]) -> Result<()> {
    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."

View on GitHub (pinned to 73e0f67d83)