{"record":{"id":"de1cf8849ca57e00","repo":"nikivdev/code","slug":"todo-not-found","errorCode":null,"errorMessage":"Todo '{}' not found","messagePattern":"Todo '(.+?)' not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/todo.rs","lineNumber":549,"sourceCode":"    if title.starts_with(\"re-run review:\") || title.contains(\"review timed out\") {\n        return true;\n    }\n    item.note\n        .as_deref()\n        .map(|n| n.to_lowercase().contains(\"review timed out\"))\n        .unwrap_or(false)\n}\n\npub(crate) fn find_item_index(items: &[TodoItem], id: &str) -> Result<usize> {\n    let mut matches = Vec::new();\n    for (idx, item) in items.iter().enumerate() {\n        if item.id == id || item.id.starts_with(id) {\n            matches.push(idx);\n        }\n    }\n\n    match matches.len() {\n        0 => bail!(\"Todo '{}' not found\", id),\n        1 => Ok(matches[0]),\n        _ => bail!(\"Todo id '{}' is ambiguous\", id),\n    }\n}\n\nfn resolve_session_ref(session: Option<&str>, no_session: bool) -> Result<Option<String>> {\n    if no_session {\n        return Ok(None);\n    }\n\n    if let Some(session) = session {\n        let trimmed = session.trim();\n        return Ok(if trimmed.is_empty() {\n            None\n        } else {\n            Some(trimmed.to_string())\n        });\n    }","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/todo.rs#L531-L567","documentation":"Raised by find_item_index (src/todo.rs:549), which resolves a user-supplied id against stored todo items by exact match or unique prefix match (item.id == id || item.id.starts_with(id)). It bails when zero items match, meaning the referenced todo does not exist in the todo file.","triggerScenarios":"Calling edit, set_status, or remove (via run) with an id that is neither a full item id nor a prefix of any stored item id — e.g. a typo, an id from a different todo file/project, or an id of an already-removed item.","commonSituations":"Using an id copied from another machine's todo list; the todo was already removed by a parallel invocation; truncated/pasted id with a typo'd character; ids rotating if items are regenerated with new UUIDs.","solutions":["Run the todo list command to see current ids and copy the correct one.","Check you are operating on the same todo file/session the item lives in (pass the right --session flag).","If the item was already removed, no action is needed.","Prefix-match a longer, verified prefix of the id to avoid ambiguity while still matching."],"exampleFix":"// before\ntodo remove a1b2\n// after: list first, then use an id from the listing\nf todo list\nf todo remove a1b2c3d4e5f6","handlingStrategy":"validation","validationCode":"// confirm the id exists before edit/remove/status ops\nconst listed = execSync(\"f todo list\").toString();\nif (!listed.includes(idPrefix)) {\n  throw new Error(`id ${idPrefix} not present in current todo list`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  removeTodo(id);\n} catch (e) {\n  if (String(e).match(/Todo '.*' not found/)) {\n    console.error(\"Refresh ids with `f todo list`; item may already be gone\");\n  } else throw e;\n}","preventionTips":["Copy ids directly from `f todo list` output instead of retyping them.","Scope operations to the correct --session so you resolve ids in the right file.","Treat 'not found' after a remove as success (idempotent cleanup scripts)."],"tags":["not-found","cli","identifier"],"backgroundTag":"resource-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}