{"record":{"id":"88c8334f87330034","repo":"aaif-goose/goose","slug":"severity-e","errorCode":null,"errorMessage":"--severity: {e}","messagePattern":"--severity: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/commands/review/handler.rs","lineNumber":91,"sourceCode":"/// Entry point for the `goose review` subcommand.\npub async fn handle_review(opts: ReviewOptions) -> Result<()> {\n    let repo_root = find_repo_root().context(\"not inside a git repository\")?;\n    let untracked_root = opts\n        .range\n        .is_none()\n        .then(|| open_untracked_root(&repo_root))\n        .transpose()?;\n\n    // Validate `--severity` once, up front, so a bogus value fails fast\n    // regardless of which orchestration path we end up taking.\n    let sev_str = if opts.severity.is_empty() {\n        \"medium\"\n    } else {\n        opts.severity.as_str()\n    };\n    let min_sev: Severity = sev_str\n        .parse()\n        .map_err(|e: String| anyhow!(\"--severity: {e}\"))?;\n\n    let mut touched = touched_files(&repo_root, opts.range.as_deref(), &opts.files)?;\n    let mut diff = collect_diff(&repo_root, opts.range.as_deref(), &opts.files)?;\n\n    // Without an explicit `--range`, `git diff HEAD` excludes untracked\n    // files entirely — brand-new files would silently miss the review.\n    // Synthesize a `new file` diff for each so the main pass and the\n    // checks see them.\n    if let Some(untracked_root) = untracked_root.as_ref() {\n        let untracked = untracked_files(untracked_root, &opts.files)?;\n        if !untracked.is_empty() {\n            let untracked_diff = synthesize_untracked_diff(untracked_root, &untracked)?;\n            diff.push_str(&untracked_diff);\n            for u in untracked {\n                if !touched.contains(&u) {\n                    touched.push(u);\n                }\n            }","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/commands/review/handler.rs#L73-L109","documentation":"`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.","triggerScenarios":"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.","commonSituations":"Porting CI thresholds from other tools with different severity vocabularies; typos; wrapper scripts written against older documentation.","solutions":["Use one of low, medium, high, critical","Omit `--severity` entirely — it defaults to medium","Check `goose review --help` on your build for the accepted set"],"exampleFix":"# before\ngoose review --severity warning\n\n# after\ngoose review --severity low   # or omit the flag (defaults to medium)","handlingStrategy":"validation","validationCode":"SEV=\"${1:-medium}\"\ncase \"$SEV\" in\n  low|med|medium|high|critical) ;;\n  *) echo \"invalid --severity '$SEV' (expected low|medium|high|critical)\" >&2; exit 2 ;;\nesac\ngoose review --severity \"$SEV\"","typeGuard":"fn is_valid_severity(s: &str) -> bool {\n    matches!(\n        s.trim().to_ascii_lowercase().as_str(),\n        \"low\" | \"med\" | \"medium\" | \"high\" | \"critical\"\n    )\n}","tryCatchPattern":null,"preventionTips":["Whitelist severity values in wrapper scripts","Document the accepted set next to CI flags","Prefer omitting the flag to take the safe default"],"tags":["review","cli","input-validation","parse-error"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}