{"record":{"id":"cddda2ab1749de07","repo":"xai-org/grok-build","slug":"session-registry-client-is-required-for-rehydratio","errorCode":null,"errorMessage":"Session registry client is required for rehydration (auth may be missing or registry is disabled)","messagePattern":"Session registry client is required for rehydration \\(auth may be missing or registry is disabled\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/session/worktree.rs","lineNumber":517,"sourceCode":"            use xai_fast_worktree::{\n                CreationMode, IgnoredFilesMode, WorkingTreeMode, WorktreeBuilder,\n            };\n            let mut builder = WorktreeBuilder::new(&source, &dest)\n                .working_tree_mode(WorkingTreeMode::CleanAll)\n                .ignored_files_mode(IgnoredFilesMode::Skip)\n                .creation_mode(CreationMode::Linked)\n                .worktree_kind(xai_fast_worktree::WorktreeKind::Fork)\n                .session_id(session_id);\n            if let Some(delegate) = btrfs_delegate {\n                builder = builder.btrfs_delegate(delegate);\n            }\n            builder.create()\n        })\n        .await\n        .map_err(|e| anyhow::anyhow!(\"worktree creation task failed: {e}\"))??;\n    }\n    let client = registry_client.ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Session registry client is required for rehydration \\\n             (auth may be missing or registry is disabled)\"\n        )\n    })?;\n    let record = client\n        .get_session(&req.session_id)\n        .await\n        .context(\"fetching session record for rehydration\")?;\n    let turn = crate::session::restore::resolve_restore_turn(&record, None);\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\"","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/session/worktree.rs#L499-L535","documentation":"rehydrate_session_in_worktree requires a session registry client to fetch the stored session record; when the Option is None it raises this error. This happens when auth was not provided or the registry is disabled, so there is no client to query the session's registry entry.","triggerScenarios":"Calling rehydrate_session_in_worktree with registry_client = None — i.e. no auth manager produced a registry client, or session registry support is disabled in configuration.","commonSituations":"Running rehydration headless/offline without credentials; deployment where the session registry feature flag is turned off; auth initialization silently failed.","solutions":["Ensure valid auth is configured so a registry client can be constructed before calling rehydrate.","Enable the session registry feature in configuration if it is disabled.","Check the code path that builds registry_client and log why it is None (auth missing vs disabled).","If registry is intentionally unavailable, use the local resume path (resume_local_session_in_worktree) instead of rehydration."],"exampleFix":"// before\nlet client = registry_client.ok_or_else(|| anyhow!(\"Session registry client is required for rehydration...\"))?;\n// after — construct a client when auth is present\nlet client = match registry_client {\n    Some(c) => c,\n    None => build_registry_client(auth_manager.as_ref()).await.ok_or_else(|| anyhow!(\"...\"))?,\n};","handlingStrategy":"validation","validationCode":"let client = build_registry_client(auth.as_ref()).await\n    .ok_or_else(|| anyhow!(\"registry unavailable: configure auth or enable session registry before rehydrating\"))?;\nif !registry_enabled() { return Err(anyhow!(\"session registry disabled\")); }","typeGuard":"fn has_registry_client(r: &Option<RegistryClient>) -> bool { r.is_some() }","tryCatchPattern":"match rehydrate_session_in_worktree(req).await {\n    Err(e) if e.to_string().contains(\"registry client is required\") => {\n        // fall back to local resume which does not need the registry\n        resume_local_session_in_worktree(req).await\n    }\n    other => other,\n}","preventionTips":["Check auth/registry configuration at startup, not at rehydrate time","Fail fast with a clear preflight check before spawning worktrees","Provide a local-resume fallback when the registry is disabled","Log why registry_client was None (auth missing vs disabled)"],"tags":["rust","registry","auth","configuration"],"backgroundTag":"missing-registry-client","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}