xai-org/grok-build · error

resolved leader target did not include a socket path

Error message

resolved leader target did not include a socket path

What it means

After leader target resolution succeeds, connect_to_leader requires the selection to expose a Unix socket path. When the resolved LeaderDescriptor has no socket_path (selection.socket_path() returned None), this error is raised — the leader is known but not connectable over IPC.

Source

Thrown at crates/codegen/xai-grok-pager-bin/src/main.rs:393

    Ok(())
}
fn resolve_target(args: &LeaderTargetArgs) -> LeaderTarget {
    match args.pid {
        Some(pid) => LeaderTarget::Pid(pid),
        None => LeaderTarget::Environment(xai_grok_shell::env::GrokBuildEnvironment::Production),
    }
}
#[tracing::instrument(skip_all)]
async fn connect_to_leader(
    args: &LeaderTargetArgs,
) -> Result<(LeaderDescriptor, xai_grok_shell::leader::LeaderClient)> {
    let target = resolve_target(args);
    let selection = xai_grok_shell::leader::resolve_leader_target(target)
        .await
        .map_err(|e| anyhow::anyhow!("{}", e.message))?;
    let socket_path = selection
        .socket_path()
        .ok_or_else(|| anyhow::anyhow!("resolved leader target did not include a socket path"))?;
    let client = xai_grok_shell::leader::LeaderClient::connect(
        socket_path.to_path_buf(),
        "grok-pager-leader-cli",
        ClientMode::Stdio,
        ClientCapabilities::default(),
    )
    .await?;
    Ok((selection.descriptor, client))
}
/// Prefer socket-verified live PID over a possibly-recycled lock file PID.
fn leader_pid(d: &LeaderDescriptor) -> Option<u32> {
    d.live_info.as_ref().map(|li| li.pid).or(d.pid_from_lock)
}
fn print_leader_descriptor(d: &LeaderDescriptor) {
    let pid = leader_pid(d)
        .map(|p| p.to_string())
        .unwrap_or_else(|| "?".into());
    let sock = d

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Confirm the leader process is a current version that registers a Unix socket path
  2. Remove stale/invalid registration entries and restart the leader so it re-registers with a socket
  3. Check the leader registry/selection code path for fields not populated in your setup
  4. If targeting a remote leader, use a transport that supports it instead of the socket-based client
Defensive patterns

Strategy: type-guard

Validate before calling

let selection = xai_grok_shell::leader::resolve_leader_target(target).await?;
if selection.socket_path().is_none() {
    return Err(anyhow!("leader for this target does not expose a local socket"));
}

Type guard

fn has_socket(sel: &xai_grok_shell::leader::LeaderSelection) -> bool {
    sel.socket_path().is_some()
}

Try / catch

let sel = resolve_leader_target(target).await?;
let socket_path = match sel.socket_path() {
    Some(p) => p.to_path_buf(),
    None => {
        eprintln!("leader target has no socket path; is the leader an up-to-date build?");
        return Err(anyhow!("missing leader socket path"));
    }
};

Prevention

When it happens

Trigger: resolve_leader_target returns a selection whose socket_path() is None — typically a leader descriptor that only carries a host/port or metadata, or a partially-populated registration entry.

Common situations: Version mismatch where an older leader registered without a socket path; manual/edited leader registry entry missing the socket; environment resolved to a remote leader that exposes no local socket.

Related errors


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