xai-org/grok-build · error
Invalid git repository structure
Error message
Invalid git repository structure
What it means
Error "Invalid git repository structure" thrown in xai-org/grok-build.
Source
Thrown at crates/codegen/xai-grok-workspace/src/worktree/mod.rs:2193
#[derive(Debug)]
struct ApplyContext {
base_commit: String,
changed_files: Vec<GitFileChange>,
}
/// Get all files that differ between the main repo and the worktree.
async fn get_apply_context(worktree_path: &str) -> Result<ApplyContext> {
let wt_path = worktree_path.to_string();
tokio::task::spawn_blocking(move || {
let wt_repo = Repository::open(&wt_path)?;
let wt_head = get_head_commit(&wt_repo)?;
let main_git_dir = wt_repo.commondir().to_path_buf();
let main_repo_path = main_git_dir
.parent()
.ok_or_else(|| anyhow::anyhow!("Invalid git repository structure"))?;
let main_repo = Repository::open(main_repo_path)?;
let main_head = get_head_commit(&main_repo)?;
let mut changed_files = Vec::new();
let mut seen_paths = HashSet::new();
// 1. Get committed changes: diff from main repo HEAD to worktree HEAD
let main_oid = Oid::from_str(&main_head)?;
let wt_oid = Oid::from_str(&wt_head)?;
let main_tree = wt_repo.find_commit(main_oid)?.tree()?;
let wt_tree = wt_repo.find_commit(wt_oid)?.tree()?;
let mut opts = DiffOptions::new();
let diff = wt_repo.diff_tree_to_tree(Some(&main_tree), Some(&wt_tree), Some(&mut opts))?;
for (idx, delta) in diff.deltas().enumerate() {
let path = delta
.new_file()View on GitHub (pinned to bc7f02eddd)
When it happens
Trigger: Thrown at crates/codegen/xai-grok-workspace/src/worktree/mod.rs:2193 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/a67afa5717f31dec.
Report an issue: GitHub.