aaif-goose/goose · error

Failed to fetch at {}

Error message

Failed to fetch at {}

What it means

fetch_origin runs `git fetch origin` inside the local clone using goose's git_command() helper (crates/goose-cli/src/recipes/github_recipe.rs:189-198). This error is the spawn io failure: the git binary could not be executed. Note the asymmetry: cloning goes through `gh` (which may shell out to its bundled logic), but fetching requires a real `git` on PATH — a machine can pass [126] and still fail here.

Source

Thrown at crates/goose-cli/src/recipes/github_recipe.rs:198

            .status()
            .map_err(|_: std::io::Error| anyhow::anyhow!(error_message.clone()))?;

        if status.success() {
            Ok(local_repo_path)
        } else {
            Err(anyhow::anyhow!(error_message))
        }
    }
}

fn fetch_origin(local_repo_path: &Path) -> Result<()> {
    let error_message: String = format!("Failed to fetch at {}", local_repo_path.to_str().unwrap());
    let status = git_command()
        .args(["fetch", "origin"])
        .current_dir(local_repo_path)
        .set_no_window()
        .status()
        .map_err(|_| anyhow::anyhow!(error_message.clone()))?;

    if status.success() {
        Ok(())
    } else {
        Err(anyhow::anyhow!(error_message))
    }
}

fn get_folder_from_github(local_repo_path: &Path, recipe_name: &str) -> Result<PathBuf> {
    let ref_and_path = format!("origin/main:{}", recipe_name);
    let output_dir = env::temp_dir().join(temp_child_name(recipe_name));

    if output_dir.exists() {
        fs::remove_dir_all(&output_dir)?;
    }
    fs::create_dir_all(&output_dir)?;

    let archive_output = git_command()

View on GitHub (pinned to 3810898a74)

Solutions

  1. Install git (`apt-get install git`, `brew install git`, etc.) and confirm `command -v git && git --version` in goose's environment
  2. If git is present, check that the clone directory printed/used still exists before the fetch — stale temp state can be cleared by removing the goose temp clone dirs and retrying
  3. In sandboxed environments, allow exec of git in the sandbox profile
Defensive patterns

Strategy: validation

Validate before calling

# goose shells out to both gh and git; verify both exist
command -v gh && command -v git && git --version

Prevention

When it happens

Trigger: Command::new("git").status() io error: git not installed (ErrorKind::NotFound), exec permission/format error, or the current_dir passed to the command no longer exists (temp clone removed by an earlier cleanup or OS temp reaper).

Common situations: Minimal containers (gh installed, git omitted), CI images without git, hosts where /tmp cleaners delete the clone mid-flow, or restricted sandboxes denying exec of git.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/9c687e744fb7f1ee. Report an issue: GitHub.