{"record":{"id":"b202460b30b8745e","repo":"aaif-goose/goose","slug":"failed-to-capture-stdout-from-git-archive","errorCode":null,"errorMessage":"Failed to capture stdout from git archive","messagePattern":"Failed to capture stdout from git archive","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/goose-cli/src/recipes/github_recipe.rs","lineNumber":225,"sourceCode":"fn get_folder_from_github(local_repo_path: &Path, recipe_name: &str) -> Result<PathBuf> {\n    let ref_and_path = format!(\"origin/main:{}\", recipe_name);\n    let output_dir = env::temp_dir().join(temp_child_name(recipe_name));\n\n    if output_dir.exists() {\n        fs::remove_dir_all(&output_dir)?;\n    }\n    fs::create_dir_all(&output_dir)?;\n\n    let archive_output = git_command()\n        .args([\"archive\", &ref_and_path])\n        .current_dir(local_repo_path)\n        .stdout(Stdio::piped())\n        .set_no_window()\n        .spawn()?;\n\n    let stdout = archive_output\n        .stdout\n        .ok_or_else(|| anyhow::anyhow!(\"Failed to capture stdout from git archive\"))?;\n\n    let mut archive = Archive::new(stdout);\n    archive.unpack(&output_dir)?;\n    list_files(&output_dir)?;\n\n    Ok(output_dir)\n}\n\nfn list_files(dir: &Path) -> Result<()> {\n    println!(\"{}\", style(\"Files downloaded from github:\").bold());\n    for entry in fs::read_dir(dir)? {\n        let entry = entry?;\n        let path = entry.path();\n        if path.is_file() {\n            println!(\"  - {}\", path.display());\n        }\n    }\n    Ok(())","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/recipes/github_recipe.rs#L207-L243","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the spawn still configures Stdio::piped for stdout in get_folder_from_github; restore it if modified","Report as an internal bug with platform/std version details if it reproduces on unmodified code"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust: if stdout were missing, fail with actionable context\nlet Some(stdout) = child.stdout else {\n    anyhow::bail!(\"git archive produced no piped stdout; spawn config was altered?\");\n};","preventionTips":["Do not modify the Stdio::piped() configuration of the git archive spawn","Treat hits of this branch as internal bugs; capture a backtrace and report upstream"],"tags":["goose-cli","git","defensive-code","unreachable"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}