{"record":{"id":"2d94a7ee8a676583","repo":"nikivdev/code","slug":"specify-a-todo-id-or-use-all-to-fix-all-open-rev","errorCode":null,"errorMessage":"Specify a todo id or use --all to fix all open review todos","messagePattern":"Specify a todo id or use --all to fix all open review todos","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/reviews_todo.rs","lineNumber":196,"sourceCode":"\n    let to_fix: Vec<_> = if let Some(id) = id {\n        let mut matched = Vec::new();\n        for item in &open_items {\n            if item.id == id || item.id.starts_with(id) {\n                matched.push(*item);\n            }\n        }\n        if matched.is_empty() {\n            bail!(\"Review todo '{}' not found among open items\", id);\n        }\n        if matched.len() > 1 {\n            bail!(\"Review todo id '{}' is ambiguous\", id);\n        }\n        matched\n    } else if all {\n        open_items\n    } else {\n        bail!(\"Specify a todo id or use --all to fix all open review todos\");\n    };\n\n    for item in &to_fix {\n        fix_single_todo(&root, item)?;\n    }\n\n    Ok(())\n}\n\nfn fix_single_todo(root: &Path, item: &todo::TodoItem) -> Result<()> {\n    let short_id = &item.id[..item.id.len().min(8)];\n    let priority = item.priority.as_deref().unwrap_or(\"P4\");\n    println!(\"==> Fixing [{}] {} : {}\", priority, short_id, item.title);\n\n    // Extract commit SHA from note (line starting with \"Commit: \")\n    let commit_sha = item\n        .note\n        .as_deref()","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/reviews_todo.rs#L178-L214","documentation":"fix_review_todos requires the caller to specify either a todo id or the --all flag; otherwise it bails with this usage error (src/reviews_todo.rs:196). It prevents the command from mutating anything when the target set is unspecified.","triggerScenarios":"Invoking the fix-todos command with neither an id argument nor --all set.","commonSituations":"Running the subcommand bare to 'see what happens'; scripting the command but forgetting to propagate the id argument; muscle memory from other tools that default to fixing everything.","solutions":["Pass the id of the todo to fix","Add --all to fix every open review todo","List open todos first to choose the right target"],"exampleFix":"// before\nfix_review_todos(root, None, false)\n// after\nfix_review_todos(root, None, true)  // or Some(id), false","handlingStrategy":"validation","validationCode":"fn fix_args_valid(id: Option<&str>, all: bool) -> bool { id.is_some() || all }\nif !fix_args_valid(id, all) { eprintln!(\"pass a todo id or --all\"); return; }","typeGuard":null,"tryCatchPattern":"match fix_review_todos(root, id, all) {\n    Err(e) if e.to_string().contains(\"Specify a todo id\") => eprintln!(\"usage: fix-todos <id> | fix-todos --all\"),\n    other => other?,\n}","preventionTips":["Wrap the command in a helper that always supplies id or --all","Fail fast in scripts when both id and --all are absent","Review CLI help before first use of a subcommand"],"tags":["cli","usage","argument-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}