{"record":{"id":"204a0148a266cf3d","repo":"xai-org/grok-build","slug":"multiple-sessions-match-title-n-listing-nre","errorCode":null,"errorMessage":"Multiple sessions match title {:?}:\\n{listing}\\nResume by session id instead: grok --resume <session-id>","messagePattern":"Multiple sessions match title (.+?):\\\\n(.+?)\\\\nResume by session id instead: grok --resume <session-id>","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/app/session_title_resolve.rs","lineNumber":72,"sourceCode":"        [] => Ok(None),\n        [only] => Ok(Some(*only)),\n        _ => {\n            let manual: Vec<&&Summary> = matches\n                .iter()\n                .filter(|s| {\n                    s.manual_title_opt()\n                        .is_some_and(|t| title_key(&t) == needle)\n                })\n                .collect();\n            if let [only] = manual.as_slice() {\n                return Ok(Some(**only));\n            }\n            let listing = matches\n                .iter()\n                .map(|s| format!(\"  {}  {:?}\", s.info.id, s.display_title()))\n                .collect::<Vec<_>>()\n                .join(\"\\n\");\n            anyhow::bail!(\n                \"Multiple sessions match title {:?}:\\n{listing}\\n\\\n                 Resume by session id instead: grok --resume <session-id>\",\n                arg.trim()\n            );\n        }\n    }\n}\n\n/// Outcome of the pre-sandbox resolution of an explicit resume arg.\n#[derive(Debug, PartialEq, Eq)]\npub(crate) enum PinnedResumeTarget {\n    /// Nothing local resolved (UUID-shaped, no cwd, junk, or ambiguous title): leave the raw arg alone.\n    /// Materialization owns the authoritative error / remote path.\n    Unresolved,\n    /// Resolved as a local id (possibly the restored child of a remote id).\n    Id(String),\n    /// Resolved by title to this session. The selected summary's persisted sandbox profile rides along.\n    /// Re-deriving the profile from the id is ambiguous when a legacy id is duplicated across cwd dirs.","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/app/session_title_resolve.rs#L54-L90","documentation":"`select_by_title` refuses to guess when more than one stored session shares the (trimmed) resume title. It bails with a listing of every matching session id and its display title, and instructs the user to resume by session id instead, because a title-only resume would be ambiguous.","triggerScenarios":"`grok --resume <title>` where the local session store contains 2+ sessions whose display title equals the argument. Reached via `select_by_title`, exercised by callers `presandbox_resume_target`, `duplicate_auto_titles_error_lists_ids_with_escaped_titles`, and `two_manual_renames_stay_ambiguous`.","commonSituations":"Multiple sessions auto-titled from the same prompt/branch name (default titles collide); two sessions manually renamed to the same title; resuming by a generic title like \"fix tests\" that was used repeatedly.","solutions":["Resume by unique id: `grok --resume <session-id>` using an id from the listing in the error.","Rename duplicate sessions to distinct titles so title resume becomes unambiguous.","Delete stale duplicate sessions to leave a single match for the title.","Provide a longer, more specific title string that matches only one session."],"exampleFix":"// before\ngrok --resume \"my-feature\"\n// error lists:\n//   <id-a>  \"my-feature\"\n//   <id-b>  \"my-feature\"\n// after\ngrok --resume <id-a>","handlingStrategy":"validation","validationCode":"let matches = sessions.iter()\n    .filter(|s| s.display_title() == requested_title)\n    .collect::<Vec<_>>();\nif matches.len() > 1 {\n    eprintln!(\"Ambiguous title; resume by id: {:?}\", matches.iter().map(|s| s.info.id).collect::<Vec<_>>());\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = select_by_title(title) {\n    let msg = e.to_string();\n    if msg.starts_with(\"Multiple sessions match title\") {\n        // parse listed ids from msg and resume the intended one by id\n        eprintln!(\"{msg}\");\n    } else { return Err(e); }\n}","preventionTips":["Give sessions unique, specific titles instead of relying on auto-titles","Prefer resuming by session id in scripts","Periodically delete or rename stale duplicate sessions"],"tags":["session-resolve","ambiguity","cli"],"backgroundTag":"ambiguous-session-title","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}