{"record":{"id":"f94469e2fab79ac4","repo":"nikivdev/code","slug":"todo-id-is-ambiguous","errorCode":null,"errorMessage":"Todo id '{}' is ambiguous","messagePattern":"Todo id '(.+?)' is ambiguous","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/todo.rs","lineNumber":551,"sourceCode":"    }\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    }\n\n    let root = project_root();","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/todo.rs#L533-L569","documentation":"Raised by find_item_index (src/todo.rs:551) when the given id prefix matches more than one todo item (matches.len() > 1). The tool supports id-prefix shortcuts, but only when the prefix uniquely identifies a single item.","triggerScenarios":"Calling edit, set_status, or remove (via run) with a short prefix (e.g. first one or two characters of a UUID) that happens to match multiple stored item ids.","commonSituations":"Large todo lists where short prefixes collide; using a 1-2 char abbreviation out of habit; pasting only the first few chars of a UUID.","solutions":["Use a longer prefix of the id until it is unique (UUIDs diverge quickly after a few chars).","Use the full 32-char simple UUID from `f todo list`.","Remove or consolidate duplicate/stale todos so prefixes become unambiguous."],"exampleFix":"// before\ntodo remove a1\n// after: use a longer unique prefix\ntodo remove a1b2c3d4","handlingStrategy":"validation","validationCode":"// ensure the prefix is unique before invoking\ncode.split(/[ \\t\\r?\\n]+/)\n// shell: count matching ids in the listing\nconst matches = execSync(\"f todo list\").toString().split(\"\\n\")\n  .filter(l => l.includes(idPrefix));\nif (matches.length > 1) throw new Error(`prefix ${idPrefix} is ambiguous (${matches.length} matches)`);","typeGuard":null,"tryCatchPattern":"try {\n  editTodo(prefix);\n} catch (e) {\n  if (String(e).match(/ambiguous/)) {\n    console.error(\"Lengthen the id prefix until it matches exactly one todo\");\n  } else throw e;\n}","preventionTips":["Use at least 6-8 characters of the UUID as the prefix.","Prefer full ids in scripts; reserve short prefixes for interactive use.","Prune stale todos regularly to reduce prefix collisions."],"tags":["ambiguity","identifier","cli"],"backgroundTag":"ambiguous-identifier","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}