aaif-goose/goose · error

--severity: {e}

Error message

--severity: {e}

What it means

`goose review` validates `--severity` once, up front, via Severity::from_str, which accepts only low, medium/med, high, and critical. Any other string fails fast with this error; the underlying parse message even lists the expected values, so no review work starts.

Source

Thrown at crates/goose-cli/src/commands/review/handler.rs:91

/// Entry point for the `goose review` subcommand.
pub async fn handle_review(opts: ReviewOptions) -> Result<()> {
    let repo_root = find_repo_root().context("not inside a git repository")?;
    let untracked_root = opts
        .range
        .is_none()
        .then(|| open_untracked_root(&repo_root))
        .transpose()?;

    // Validate `--severity` once, up front, so a bogus value fails fast
    // regardless of which orchestration path we end up taking.
    let sev_str = if opts.severity.is_empty() {
        "medium"
    } else {
        opts.severity.as_str()
    };
    let min_sev: Severity = sev_str
        .parse()
        .map_err(|e: String| anyhow!("--severity: {e}"))?;

    let mut touched = touched_files(&repo_root, opts.range.as_deref(), &opts.files)?;
    let mut diff = collect_diff(&repo_root, opts.range.as_deref(), &opts.files)?;

    // Without an explicit `--range`, `git diff HEAD` excludes untracked
    // files entirely — brand-new files would silently miss the review.
    // Synthesize a `new file` diff for each so the main pass and the
    // checks see them.
    if let Some(untracked_root) = untracked_root.as_ref() {
        let untracked = untracked_files(untracked_root, &opts.files)?;
        if !untracked.is_empty() {
            let untracked_diff = synthesize_untracked_diff(untracked_root, &untracked)?;
            diff.push_str(&untracked_diff);
            for u in untracked {
                if !touched.contains(&u) {
                    touched.push(u);
                }
            }

View on GitHub (pinned to 3810898a74)

Solutions

  1. Use one of low, medium, high, critical
  2. Omit `--severity` entirely — it defaults to medium
  3. Check `goose review --help` on your build for the accepted set

Example fix

# before
goose review --severity warning

# after
goose review --severity low   # or omit the flag (defaults to medium)
Defensive patterns

Strategy: validation

Validate before calling

SEV="${1:-medium}"
case "$SEV" in
  low|med|medium|high|critical) ;;
  *) echo "invalid --severity '$SEV' (expected low|medium|high|critical)" >&2; exit 2 ;;
esac
goose review --severity "$SEV"

Type guard

fn is_valid_severity(s: &str) -> bool {
    matches!(
        s.trim().to_ascii_lowercase().as_str(),
        "low" | "med" | "medium" | "high" | "critical"
    )
}

Prevention

When it happens

Trigger: Running `goose review --severity warning` (or info/normal/minor/none) — values valid in other lint tools but absent from goose's Severity enum; the parse error propagates before any git command runs.

Common situations: Porting CI thresholds from other tools with different severity vocabularies; typos; wrapper scripts written against older documentation.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/88c8334f87330034. Report an issue: GitHub.