{"record":{"id":"5fa21ea45b9c5dd2","repo":"xai-org/grok-build","slug":"session-id-session-id","errorCode":null,"errorMessage":"{} (session id: {session_id})","messagePattern":"(.+?) \\(session id: (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/app/mod.rs","lineNumber":736,"sourceCode":"        )?;\n        if let Some(ref cfg) = lw {\n            session_startup::emit_local_workspace_startup_ux(cfg)?;\n        }\n        session_startup::set_active_local_workspace(lw)?;\n    }\n    let intent = args\n        .session_startup_intent()\n        .map_err(|e| anyhow::anyhow!(\"{e}\"))?;\n    let mut materialize_ctx = session_startup::MaterializeCtx::from_pager_args(&args);\n    materialize_ctx.restore_progress_on_stdout =\n        std::io::IsTerminal::is_terminal(&std::io::stdout());\n    let materialized = session_startup::materialize_startup(materialize_ctx, intent).await?;\n    if args.chat()\n        && let session_startup::MaterializedStartup::Resume { session_id, .. } = &materialized\n    {\n        let cwd = std::env::current_dir().unwrap_or_default();\n        if session_startup::chat_mode_refuses_local_build_load(true, false, session_id, &cwd) {\n            anyhow::bail!(\n                \"{} (session id: {session_id})\",\n                session_startup::CHAT_MODE_LOCAL_BUILD_REFUSAL\n            );\n        }\n    }\n    let mut session_title = match &materialized {\n        session_startup::MaterializedStartup::Resume { title, .. }\n        | session_startup::MaterializedStartup::Fork {\n            parent_title: title,\n            ..\n        } => title.clone(),\n        _ => None,\n    };\n    let title_lookup_id = match &materialized {\n        session_startup::MaterializedStartup::Resume { session_id, .. } => {\n            Some(session_id.as_str())\n        }\n        session_startup::MaterializedStartup::Fork {","sourceCodeStart":718,"sourceCodeEnd":754,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/app/mod.rs#L718-L754","documentation":"When chat mode resumes a previously materialized session, the code checks `chat_mode_refuses_local_build_load(true, false, session_id, &cwd)`. If the session's recorded build/workspace state must not be loaded in chat mode (e.g. it was a local build), startup bails with `CHAT_MODE_LOCAL_BUILD_REFUSAL` plus the session id, refusing to silently resume an incompatible session.","triggerScenarios":"`--chat` with a resume intent where `materialize_startup` yields `MaterializedStartup::Resume { session_id, .. }` and `chat_mode_refuses_local_build_load` returns true for the current cwd (mod.rs:736).","commonSituations":"Resuming an old session id in chat mode after the session was created as a local-build session; running chat from a different cwd whose recorded build is refused; stale session ids reused in scripts.","solutions":["Resume the session without `--chat`, or start a fresh chat session","Delete/abandon the incompatible session and create a new one","Run from the expected cwd or re-materialize the session so its state matches chat mode"],"exampleFix":"// before\ngrok-pager --chat --resume <local-build-session-id>\n// after\ngrok-pager --resume <session-id>   # without --chat, or start a new chat session","handlingStrategy":"try-catch","validationCode":"fn can_resume_in_chat(materialized: &MaterializedStartup) -> bool {\n    !matches!(materialized, MaterializedStartup::Resume { .. })\n}","typeGuard":"fn is_resume(m: &MaterializedStartup) -> Option<&str> {\n    match m { MaterializedStartup::Resume { session_id, .. } => Some(session_id), _ => None }\n}","tryCatchPattern":"match run_pager(args).await {\n    Err(e) if e.to_string().contains(\"session id:\") => {\n        eprintln!(\"chat mode refused this session resume; retry without --chat or use a new session: {e}\")\n    }\n    other => other.expect(\"startup\"),\n}","preventionTips":["Track which sessions were created as local-build sessions","Avoid reusing old session ids across modes","Re-materialize or recreate sessions when switching between chat and non-chat modes"],"tags":["cli","session","resume","refusal"],"backgroundTag":"session-resume-refused","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}