{"record":{"id":"378722054ecbf47c","repo":"nikivdev/code","slug":"unsupported-f-pr-preview-mode-value-other","errorCode":null,"errorMessage":"unsupported `f pr preview --mode` value: {other}","messagePattern":"unsupported `f pr preview --mode` value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pr_preview.rs","lineNumber":320,"sourceCode":"                index += 2;\n            }\n            token => bail!(\"unknown `f pr preview` option: {token}\"),\n        }\n    }\n\n    Ok(Some(PrPreviewCommand {\n        repo_path,\n        requested_base,\n        mode,\n        json,\n    }))\n}\n\nfn parse_mode_arg(value: &str) -> Result<PrPreviewModeArg> {\n    match value.trim().to_ascii_lowercase().as_str() {\n        \"draft\" => Ok(PrPreviewModeArg::Draft),\n        \"feedback\" => Ok(PrPreviewModeArg::Feedback),\n        other => bail!(\"unsupported `f pr preview --mode` value: {other}\"),\n    }\n}\n\npub fn run_pr_preview(cmd: PrPreviewCommand) -> Result<()> {\n    let start = cmd\n        .repo_path\n        .clone()\n        .unwrap_or(std::env::current_dir().context(\"failed to resolve current directory\")?);\n    let context = resolve_preview_context(&start)?;\n    let packet = build_preview_packet(&context, &cmd)?;\n    let result = if packet.diff_stats.files == 0 {\n        clear_preview_artifacts(&context.review_root)?;\n        PrPreviewRunResult {\n            status: \"cleared\".to_string(),\n            source: \"flow\".to_string(),\n            review_root: context.review_root.display().to_string(),\n            preview_json_path: context\n                .review_root","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/pr_preview.rs#L302-L338","documentation":"parse_mode_arg validates the --mode value case-insensitively against \"draft\" and \"feedback\". Any other string reaches this error, which echoes the offending value.","triggerScenarios":"Running `f pr preview --mode review` (or any value other than draft/feedback, after trimming and lowercasing).","commonSituations":"Guessing mode names (e.g. \"pr\", \"open\", \"ready\"); capitalization is tolerated but wrong words are not; scripts with hard-coded invalid modes.","solutions":["Use `--mode draft` or `--mode feedback`","Check the exact value in the error message and correct it in scripts","Omit --mode entirely to use the default (draft)"],"exampleFix":"// before\nf pr preview --mode review\n// after\nf pr preview --mode feedback","handlingStrategy":"validation","validationCode":"let mode = value.trim().to_ascii_lowercase();\nif !matches!(mode.as_str(), \"draft\" | \"feedback\") {\n    anyhow::bail!(\"mode must be draft or feedback\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = run_pr_preview(cmd) {\n    if e.to_string().contains(\"unsupported `f pr preview --mode` value\") {\n        eprintln!(\"Use --mode draft or --mode feedback\");\n    }\n}","preventionTips":["Only pass draft or feedback as --mode values","Omit --mode to get the default (draft)","Centralize mode constants in scripts to avoid typos"],"tags":["cli","argument-parsing","validation","pr"],"backgroundTag":"invalid-enum-value","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}