xai-org/grok-build · error

{} (session id: {session_id})

Error message

{} (session id: {session_id})

What it means

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.

Source

Thrown at crates/codegen/xai-grok-pager/src/app/mod.rs:736

        )?;
        if let Some(ref cfg) = lw {
            session_startup::emit_local_workspace_startup_ux(cfg)?;
        }
        session_startup::set_active_local_workspace(lw)?;
    }
    let intent = args
        .session_startup_intent()
        .map_err(|e| anyhow::anyhow!("{e}"))?;
    let mut materialize_ctx = session_startup::MaterializeCtx::from_pager_args(&args);
    materialize_ctx.restore_progress_on_stdout =
        std::io::IsTerminal::is_terminal(&std::io::stdout());
    let materialized = session_startup::materialize_startup(materialize_ctx, intent).await?;
    if args.chat()
        && let session_startup::MaterializedStartup::Resume { session_id, .. } = &materialized
    {
        let cwd = std::env::current_dir().unwrap_or_default();
        if session_startup::chat_mode_refuses_local_build_load(true, false, session_id, &cwd) {
            anyhow::bail!(
                "{} (session id: {session_id})",
                session_startup::CHAT_MODE_LOCAL_BUILD_REFUSAL
            );
        }
    }
    let mut session_title = match &materialized {
        session_startup::MaterializedStartup::Resume { title, .. }
        | session_startup::MaterializedStartup::Fork {
            parent_title: title,
            ..
        } => title.clone(),
        _ => None,
    };
    let title_lookup_id = match &materialized {
        session_startup::MaterializedStartup::Resume { session_id, .. } => {
            Some(session_id.as_str())
        }
        session_startup::MaterializedStartup::Fork {

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Resume the session without `--chat`, or start a fresh chat session
  2. Delete/abandon the incompatible session and create a new one
  3. Run from the expected cwd or re-materialize the session so its state matches chat mode

Example fix

// before
grok-pager --chat --resume <local-build-session-id>
// after
grok-pager --resume <session-id>   # without --chat, or start a new chat session
Defensive patterns

Strategy: try-catch

Validate before calling

fn can_resume_in_chat(materialized: &MaterializedStartup) -> bool {
    !matches!(materialized, MaterializedStartup::Resume { .. })
}

Type guard

fn is_resume(m: &MaterializedStartup) -> Option<&str> {
    match m { MaterializedStartup::Resume { session_id, .. } => Some(session_id), _ => None }
}

Try / catch

match run_pager(args).await {
    Err(e) if e.to_string().contains("session id:") => {
        eprintln!("chat mode refused this session resume; retry without --chat or use a new session: {e}")
    }
    other => other.expect("startup"),
}

Prevention

When it happens

Trigger: `--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).

Common situations: 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.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/5fa21ea45b9c5dd2. Report an issue: GitHub.