xai-org/grok-build · critical · anyhow::Error

OUT_OF_DISK_CONTEXT

Error message

OUT_OF_DISK_CONTEXT

What it means

In `try_grove_worktree`, when the NFS attempt reports NfsTryError::StorageFull, the error is converted to io::ErrorKind::StorageFull and wrapped with the OUT_OF_DISK_CONTEXT context string. It tells callers that the grove/NFS-backed worktree store has no space left, and (per the design) that this specific failure should trigger the copy-based fallback rather than being a generic bug.

Source

Thrown at crates/codegen/xai-fast-worktree/src/nfs/mod.rs:201

            }
            if let Some(b) = backing {
                grove["backing"] = serde_json::Value::String(b);
            }
            let metadata = serde_json::json!({ "grove": grove });
            Ok(Some(CreateWorktreeResult {
                worktree_path: adopted.dest,
                commit,
                copy_stats: CopyStats::default(),
                ignored_stats: None,
                dirty_files_report: None,
                resolved_strategy: grove_resolved_strategy(&adopted.transport),
                strategy_metadata: Some(metadata),
            }))
        }
        Ok(NfsCreateDecision::Fallback) => Ok(None),
        Err(NfsTryError::StorageFull) => {
            let err = std::io::Error::from(std::io::ErrorKind::StorageFull);
            Err(anyhow::Error::new(err).context(OUT_OF_DISK_CONTEXT))
        }
        Err(NfsTryError::InFlight { phase }) => Err(anyhow::anyhow!(
            "nfs worktree create still in progress (phase={phase}); not falling back to copy"
        )),
        Err(NfsTryError::IdentityConflict(msg)) => {
            Err(anyhow::anyhow!("{msg}; not falling back to copy"))
        }
        Err(NfsTryError::Other(e)) => Err(e).context("nfs worktree create failed"),
    }
}
/// Adopt succeeded but dest HEAD is unreadable. Tear the mount down so dest
/// is not left projected with no worktrees.db row. Copy-fallback only when
/// dest is known unmounted.
fn teardown_after_failed_head_read(
    client: &NfsWorktreeClient,
    dest: &Path,
    head_err: anyhow::Error,
) -> Result<Option<CreateWorktreeResult>> {

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Fall back to the copy-based worktree creation path (try_grove_worktree returns the error precisely so callers can do this).
  2. Free space on the NFS grove volume: prune old worktrees and snapshots, or expand the volume/quota.
  3. Monitor grove disk usage and alert before exhaustion (df/quota checks in ops).
  4. Check for a single user/job filling the volume and throttle it.

Example fix

// before
let wt = try_grove_worktree(req).await?;
// after
let wt = match try_grove_worktree(req).await {
    Ok(Some(wt)) => wt,
    Ok(None) | Err(e) if e.root_cause().to_string().contains("OUT_OF_DISK_CONTEXT") => {
        tracing::warn!("grove out of disk; falling back to copy");
        create_by_copy(req).await?
    }
    Err(e) => return Err(e),
};
Defensive patterns

Strategy: fallback

Validate before calling

// approximate pre-check before requesting an NFS grove worktree
let avail = statvfs(NFS_MOUNT)?.available_bytes();
if avail < MIN_WORKTREE_BYTES { skip_grove_and_use_copy(); }

Type guard

fn is_out_of_disk_context(err: &anyhow::Error) -> bool {
    err.chain().any(|c| c.to_string().contains("OUT_OF_DISK_CONTEXT"))
        || err.root_cause().downcast_ref::<io::Error>()
            .map_or(false, |e| e.kind() == io::ErrorKind::StorageFull)
}

Try / catch

match try_grove_worktree(req).await {
    Ok(Some(wt)) => wt,
    Ok(None) => create_by_copy(req).await?,
    Err(e) if is_out_of_disk_context(&e) => create_by_copy(req).await?,
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling the worktree-create path that routes through the NFS grove when the underlying NFS volume is out of space (NfsTryError::StorageFull returned from the daemon or client checks).

Common situations: Shared NFS server disk quota exhausted; runaway accumulation of worktrees/snapshots on the grove volume; quota per-user limits hit on a multi-tenant NFS export.

Related errors


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