aaif-goose/goose · warning

Failed to capture stdout from git archive

Error message

Failed to capture stdout from git archive

What it means

get_folder_from_github spawns `git archive` with Stdio::piped and then takes the child's stdout handle (crates/goose-cli/src/recipes/github_recipe.rs:220-226). The Option is None only if the child somehow has no piped stdout despite the piped() configuration. Since the same spawn call set Stdio::piped, this branch is defensive and effectively unreachable in current std.

Source

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

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()
        .args(["archive", &ref_and_path])
        .current_dir(local_repo_path)
        .stdout(Stdio::piped())
        .set_no_window()
        .spawn()?;

    let stdout = archive_output
        .stdout
        .ok_or_else(|| anyhow::anyhow!("Failed to capture stdout from git archive"))?;

    let mut archive = Archive::new(stdout);
    archive.unpack(&output_dir)?;
    list_files(&output_dir)?;

    Ok(output_dir)
}

fn list_files(dir: &Path) -> Result<()> {
    println!("{}", style("Files downloaded from github:").bold());
    for entry in fs::read_dir(dir)? {
        let entry = entry?;
        let path = entry.path();
        if path.is_file() {
            println!("  - {}", path.display());
        }
    }
    Ok(())

View on GitHub (pinned to 3810898a74)

Solutions

  1. Confirm the spawn still configures Stdio::piped for stdout in get_folder_from_github; restore it if modified
  2. Report as an internal bug with platform/std version details if it reproduces on unmodified code
Defensive patterns

Strategy: try-catch

Try / catch

// Rust: if stdout were missing, fail with actionable context
let Some(stdout) = child.stdout else {
    anyhow::bail!("git archive produced no piped stdout; spawn config was altered?");
};

Prevention

When it happens

Trigger: Requires an inconsistency between Stdio::piped() configuration and the returned Child's stdout field — not producible via normal APIs. Would only appear if the spawn configuration were changed (e.g., dropping the piped() line) or via a std/platform quirk.

Common situations: None in practice; if reported, suspect a patched build or a platform-specific std regression, and treat it as an internal bug rather than a configuration problem.

Related errors


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