xai-org/grok-build · error

session-state archive restore unavailable in this build

Error message

session-state archive restore unavailable in this build

What it means

resume_session_in_worktree builds two parallel restore futures: one downloads memory.tar.gz from the remote client, the other restores the session-state archive. The state-restore future is stubbed as an always-failing async block because archive restoration is not implemented in this build, so the error is unconditional whenever this code path runs. The result is joined via tokio::join! so the caller always receives this failure for the state half.

Source

Thrown at crates/codegen/xai-grok-shell/src/session/worktree.rs:264

        worktree_type,
        req.git_ref.clone(),
        grove_worktree,
    )
    .await?;
    let record = client
        .get_session(&req.session_id)
        .await
        .context("fetching session record for remote restore")?;
    let turn = crate::session::restore::resolve_restore_turn(&record, None);
    let restore_code = remote_worktree_restores_codebase(req.restore_code, restore_code_default);
    let memory_dl_future = crate::session::restore::download_to_tempfile(
        client,
        &req.session_id,
        "memory.tar.gz",
        turn,
    );
    let state_dl_future = async {
        Err(anyhow::anyhow!(
            "session-state archive restore unavailable in this build"
        ))
    };
    let (memory_dl, state_dl) = {
        let _ = restore_code;
        tokio::join!(memory_dl_future, state_dl_future)
    };
    let codebase_ok = false;
    let _memory_result =
        crate::session::restore::apply_memory_download(memory_dl, &wt_resp.worktree_path).await;
    let (session_state_result, local_session_id) =
        crate::session::restore::apply_session_state_download(
            state_dl,
            &req.session_id,
            &wt_resp.worktree_path,
        )
        .await;
    if session_state_result.is_skipped() {

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Do not treat the state-restore failure as fatal: inspect the joined tuple and continue with just the memory download if the state half is expected to be missing.
  2. Rebuild/upgrade to a build where session-state archive restore is implemented.
  3. Check build flags/features that gate session-state restore and enable the corresponding feature.
  4. Handle the Err from state_dl explicitly and surface a warning rather than propagating it.

Example fix

// before
let state_dl_future = async {
    Err(anyhow::anyhow!("session-state archive restore unavailable in this build"))
};
// after — tolerate the missing capability
let state_dl = state_dl_future.await;
if let Err(e) = &state_dl {
    tracing::warn!("state archive restore skipped: {e}");
}
Defensive patterns

Strategy: fallback

Validate before calling

// No pre-call check can detect this build stub; detect capability instead.
fn state_restore_supported() -> bool { cfg!(feature = "session-state-archive") }

Try / catch

match resume_session_in_worktree(req).await {
    Ok(r) => r,
    Err(e) if e.to_string().contains("unavailable in this build") => {
        tracing::warn!("state archive restore unsupported; continuing with memory only");
        fallback_resume_without_state(req).await?
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Any call to resume_session_in_worktree (directly or via handle) that reaches the restore step — the state archive download future is hard-coded to fail.

Common situations: Restoring/resuming a session in a git worktree on a build compiled without session-state archive support; user expects full state restore but only the memory archive path exists.

Related errors


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