{"record":{"id":"5c51fb2b04653fe1","repo":"nikivdev/code","slug":"multiple-session-doc-queue-entries-match-session","errorCode":null,"errorMessage":"multiple session-doc queue entries match `{session_hint}`","messagePattern":"multiple session-doc queue entries match `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/codex_session_docs.rs","lineNumber":1440,"sourceCode":"    session_hint: &str,\n) -> Result<usize> {\n    let project_root = project_root.display().to_string();\n    let matches = entries\n        .iter()\n        .enumerate()\n        .filter(|(_, entry)| {\n            entry.target_root == project_root\n                && (entry.session_id == session_hint\n                    || entry.session_key == session_hint\n                    || entry.session_id.starts_with(session_hint)\n                    || entry.session_key.starts_with(session_hint))\n        })\n        .map(|(index, _)| index)\n        .collect::<Vec<_>>();\n    match matches.as_slice() {\n        [index] => Ok(*index),\n        [] => bail!(\"no session-doc queue entry matches `{session_hint}`\"),\n        _ => bail!(\"multiple session-doc queue entries match `{session_hint}`\"),\n    }\n}\n\nfn git_changed_paths(project_root: &Path) -> Result<Vec<String>> {\n    let output = Command::new(\"git\")\n        .args([\"status\", \"--porcelain\", \"--untracked-files=all\"])\n        .current_dir(project_root)\n        .output()\n        .context(\"failed to run git status\")?;\n    if !output.status.success() {\n        bail!(\"git status failed with {}\", output.status);\n    }\n    let stdout = String::from_utf8_lossy(&output.stdout);\n    let mut paths = Vec::new();\n    for line in stdout.lines() {\n        if line.len() < 4 {\n            continue;\n        }","sourceCodeStart":1422,"sourceCodeEnd":1458,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/codex_session_docs.rs#L1422-L1458","documentation":"The queue resolver accepts a hint that may match by prefix; when more than one queue entry matches, the target is ambiguous so the library refuses to choose. The DECLARED selector here is the `_` arm of the match, i.e. any result with 2+ matches.","triggerScenarios":"Passing a short/ambiguous prefix (e.g. \"se\") that is a prefix of multiple session_keys in the review queue.","commonSituations":"Users abbreviating session ids too aggressively; sessions with shared id prefixes (same date/branch prefix); duplicate entries appended across runs.","solutions":["Provide a longer, unique hint (more characters of the session_key)","Use the full exact session_key from the queue listing","Deduplicate the queue file if genuine duplicate entries exist"],"exampleFix":"// before\nresolve_entry(\"se\")?; // ambiguous\n// after\nresolve_entry(\"sess_1f3a9c\")?; // full unique key","handlingStrategy":"validation","validationCode":"let count = entries.iter()\n    .filter(|e| e.session_key == hint || e.session_key.starts_with(hint)).count();\nanyhow::ensure!(count <= 1, \"hint `{hint}` is ambiguous ({count} matches); use a longer prefix\");","typeGuard":"fn is_unambiguous_prefix<'a>(entries: &'a [DocReviewQueueEntry], hint: &str) -> Option<&'a DocReviewQueueEntry> {\n    let m: Vec<_> = entries.iter().filter(|e| e.session_key.starts_with(hint)).collect();\n    match m.as_slice() { [only] => Some(only), _ => None }\n}","tryCatchPattern":"match resolve_entry(hint) {\n    Ok(i) => i,\n    Err(e) if e.to_string().contains(\"multiple session-doc queue entries\") => {\n        pick_from_listed_matches(hint)?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use full session keys, not short prefixes, in scripts and commands","Keep session keys globally unique (avoid shared date/branch prefixes in ids)","Deduplicate the queue file if repeated runs append duplicate entries"],"tags":["session","queue","ambiguity","user-input"],"backgroundTag":"queue-entry-ambiguous","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}