nikivdev/code · error

Review todo '{}' not found

Error message

Review todo '{}' not found

What it means

done_review_todo (src/reviews_todo.rs) matches a user-supplied todo id against stored review todos by exact match or prefix. When zero items match, it bails with 'Review todo ... not found'. This surfaces typos or ids referencing completed/removed todos.

Source

Thrown at src/reviews_todo.rs:147

        .filter(|(_, item)| {
            item.external_ref
                .as_deref()
                .map(|r| r.starts_with("flow-review-issue-"))
                .unwrap_or(false)
        })
        .map(|(i, _)| i)
        .collect();

    // Match by id prefix among review items
    let mut matches = Vec::new();
    for &idx in &review_indices {
        if items[idx].id == id || items[idx].id.starts_with(id) {
            matches.push(idx);
        }
    }

    let idx = match matches.len() {
        0 => bail!("Review todo '{}' not found", id),
        1 => matches[0],
        _ => bail!("Review todo id '{}' is ambiguous", id),
    };

    if items[idx].status == "completed" {
        println!("Already completed: {}", items[idx].id);
        return Ok(());
    }

    items[idx].status = "completed".to_string();
    items[idx].updated_at = Some(Utc::now().to_rfc3339());
    todo::save_items(&path, &items)?;
    println!("✓ {} -> completed", items[idx].id);

    Ok(())
}

fn fix_review_todos(id: Option<&str>, all: bool) -> Result<()> {

View on GitHub (pinned to a747e741ae)

Solutions

  1. List current review todos to get valid ids (e.g. list todos command)
  2. Use the full id or a longer unambiguous prefix
  3. Check the todos file location is the one you expect (correct repo/root)

Example fix

// before
done_review_todo(root, "abc")  // no todo starts with "abc"
// after
done_review_todo(root, "abc123de")  // full id from the todo list
Defensive patterns

Strategy: validation

Validate before calling

let ids = list_review_todos(root)?;
let id = ids.iter().find(|t| t.id == requested || t.id.starts_with(requested))
    .ok_or_else(|| anyhow!("id {requested} not in current todos"))?;
done_review_todo(root, &id.id)?;

Try / catch

match done_review_todo(root, id) {
    Err(e) if e.to_string().contains("not found") => eprintln!("run the todo list command to get valid ids"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling the done/todo-complete command with an id that neither equals any stored todo id nor is a prefix of one.

Common situations: Using a prefix that is shorter than the stored id and matches nothing; the todo was already completed and pruned from the list; stale todos file; typo in the id.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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