nikivdev/code · error

Specify a todo id or use --all to fix all open review todos

Error message

Specify a todo id or use --all to fix all open review todos

What it means

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.

Source

Thrown at src/reviews_todo.rs:196

    let to_fix: Vec<_> = if let Some(id) = id {
        let mut matched = Vec::new();
        for item in &open_items {
            if item.id == id || item.id.starts_with(id) {
                matched.push(*item);
            }
        }
        if matched.is_empty() {
            bail!("Review todo '{}' not found among open items", id);
        }
        if matched.len() > 1 {
            bail!("Review todo id '{}' is ambiguous", id);
        }
        matched
    } else if all {
        open_items
    } else {
        bail!("Specify a todo id or use --all to fix all open review todos");
    };

    for item in &to_fix {
        fix_single_todo(&root, item)?;
    }

    Ok(())
}

fn fix_single_todo(root: &Path, item: &todo::TodoItem) -> Result<()> {
    let short_id = &item.id[..item.id.len().min(8)];
    let priority = item.priority.as_deref().unwrap_or("P4");
    println!("==> Fixing [{}] {} : {}", priority, short_id, item.title);

    // Extract commit SHA from note (line starting with "Commit: ")
    let commit_sha = item
        .note
        .as_deref()

View on GitHub (pinned to a747e741ae)

Solutions

  1. Pass the id of the todo to fix
  2. Add --all to fix every open review todo
  3. List open todos first to choose the right target

Example fix

// before
fix_review_todos(root, None, false)
// after
fix_review_todos(root, None, true)  // or Some(id), false
Defensive patterns

Strategy: validation

Validate before calling

fn fix_args_valid(id: Option<&str>, all: bool) -> bool { id.is_some() || all }
if !fix_args_valid(id, all) { eprintln!("pass a todo id or --all"); return; }

Try / catch

match fix_review_todos(root, id, all) {
    Err(e) if e.to_string().contains("Specify a todo id") => eprintln!("usage: fix-todos <id> | fix-todos --all"),
    other => other?,
}

Prevention

When it happens

Trigger: Invoking the fix-todos command with neither an id argument nor --all set.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/2d94a7ee8a676583. Report an issue: GitHub.