{"record":{"id":"51143e3b396cf195","repo":"xai-org/grok-build","slug":"session-state-archive-restore-unavailable-in-this","errorCode":null,"errorMessage":"session-state archive restore unavailable in this build","messagePattern":"session-state archive restore unavailable in this build","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/session/worktree.rs","lineNumber":264,"sourceCode":"        worktree_type,\n        req.git_ref.clone(),\n        grove_worktree,\n    )\n    .await?;\n    let record = client\n        .get_session(&req.session_id)\n        .await\n        .context(\"fetching session record for remote restore\")?;\n    let turn = crate::session::restore::resolve_restore_turn(&record, None);\n    let restore_code = remote_worktree_restores_codebase(req.restore_code, restore_code_default);\n    let memory_dl_future = crate::session::restore::download_to_tempfile(\n        client,\n        &req.session_id,\n        \"memory.tar.gz\",\n        turn,\n    );\n    let state_dl_future = async {\n        Err(anyhow::anyhow!(\n            \"session-state archive restore unavailable in this build\"\n        ))\n    };\n    let (memory_dl, state_dl) = {\n        let _ = restore_code;\n        tokio::join!(memory_dl_future, state_dl_future)\n    };\n    let codebase_ok = false;\n    let _memory_result =\n        crate::session::restore::apply_memory_download(memory_dl, &wt_resp.worktree_path).await;\n    let (session_state_result, local_session_id) =\n        crate::session::restore::apply_session_state_download(\n            state_dl,\n            &req.session_id,\n            &wt_resp.worktree_path,\n        )\n        .await;\n    if session_state_result.is_skipped() {","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/session/worktree.rs#L246-L282","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Rebuild/upgrade to a build where session-state archive restore is implemented.","Check build flags/features that gate session-state restore and enable the corresponding feature.","Handle the Err from state_dl explicitly and surface a warning rather than propagating it."],"exampleFix":"// before\nlet state_dl_future = async {\n    Err(anyhow::anyhow!(\"session-state archive restore unavailable in this build\"))\n};\n// after — tolerate the missing capability\nlet state_dl = state_dl_future.await;\nif let Err(e) = &state_dl {\n    tracing::warn!(\"state archive restore skipped: {e}\");\n}","handlingStrategy":"fallback","validationCode":"// No pre-call check can detect this build stub; detect capability instead.\nfn state_restore_supported() -> bool { cfg!(feature = \"session-state-archive\") }","typeGuard":null,"tryCatchPattern":"match resume_session_in_worktree(req).await {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains(\"unavailable in this build\") => {\n        tracing::warn!(\"state archive restore unsupported; continuing with memory only\");\n        fallback_resume_without_state(req).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Gate the resume/rehydrate UI on the session-state-archive feature flag","Log a warning once at startup when state restore is stubbed","Prefer builds with the feature enabled in production","Treat per-half download results independently rather than failing the whole resume"],"tags":["rust","worktree","unimplemented-feature","session-restore"],"backgroundTag":"feature-not-available-in-build","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}