{"record":{"id":"f69837abbd6cb231","repo":"nikivdev/code","slug":"f-pr-preview-base-requires-a-value","errorCode":null,"errorMessage":"`f pr preview --base` requires a value","messagePattern":"`f pr preview --base` requires a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pr_preview.rs","lineNumber":292,"sourceCode":"    let mut json = opts.json;\n\n    let mut index = 1;\n    while index < args.len() {\n        match args[index].as_str() {\n            \"--json\" => {\n                json = true;\n                index += 1;\n            }\n            \"--mode\" => {\n                let Some(value) = args.get(index + 1) else {\n                    bail!(\"`f pr preview --mode` requires a value\");\n                };\n                mode = parse_mode_arg(value)?;\n                index += 2;\n            }\n            \"--base\" => {\n                let Some(value) = args.get(index + 1) else {\n                    bail!(\"`f pr preview --base` requires a value\");\n                };\n                requested_base = value.clone();\n                index += 2;\n            }\n            \"--path\" => {\n                let Some(value) = args.get(index + 1) else {\n                    bail!(\"`f pr preview --path` requires a value\");\n                };\n                repo_path = Some(PathBuf::from(value));\n                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,","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/pr_preview.rs#L274-L310","documentation":"The `--base` flag of `f pr preview` requires a value specifying the base branch/ref. This error is thrown when --base appears with no following argument.","triggerScenarios":"Running `f pr preview --base` as the final argument, leaving requested_base unset with nothing to consume.","commonSituations":"Forgotten branch name after --base; scripts where the branch variable expanded to empty; copy-paste dropping the value.","solutions":["Supply a base ref: `f pr preview --base main`","Check that any variable holding the branch name is non-empty in scripts","Quote the branch value if it contains special characters"],"exampleFix":"// before\nf pr preview --base\n// after\nf pr preview --base main","handlingStrategy":"validation","validationCode":"if args.iter().any(|a| a == \"--base\") {\n    let i = args.iter().position(|a| a == \"--base\").unwrap();\n    if args.get(i + 1).is_none() { anyhow::bail!(\"--base needs a branch/ref\"); }\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = run_pr_preview(cmd) {\n    if e.to_string().contains(\"--base`) requires a value\") {\n        eprintln!(\"Usage: f pr preview --base <branch>\");\n    }\n}","preventionTips":["Always supply a branch name after --base","Verify variables like $BRANCH are non-empty in scripts","Quote refs containing slashes or special chars"],"tags":["cli","argument-parsing","pr"],"backgroundTag":"missing-argument-value","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}