aaif-goose/goose · error
Failed to run `gh auth status`. Make sure you have `gh` inst
Error message
Failed to run `gh auth status`. Make sure you have `gh` installed.
What it means
goose shells out to the GitHub CLI (`gh auth status`) to verify authentication before touching recipe repos (crates/goose-cli/src/recipes/github_recipe.rs:105-113). Command::status() returns an io::Error when the `gh` process cannot even be spawned, and that io error is discarded and replaced by this message. It does NOT mean authentication failed — it means `gh` was never executed.
Source
Thrown at crates/goose-cli/src/recipes/github_recipe.rs:112
download_dir.display(),
RECIPE_FILE_EXTENSIONS
))
}
fn clone_and_download_recipe(recipe_name: &str, recipe_repo_full_name: &str) -> Result<PathBuf> {
let local_repo_path = ensure_repo_cloned(recipe_repo_full_name)?;
fetch_origin(&local_repo_path)?;
get_folder_from_github(&local_repo_path, recipe_name)
}
pub fn ensure_gh_authenticated() -> Result<()> {
// Check authentication status
let status = Command::new("gh")
.args(["auth", "status"])
.set_no_window()
.status()
.map_err(|_| {
anyhow::anyhow!("Failed to run `gh auth status`. Make sure you have `gh` installed.")
})?;
if status.success() {
return Ok(());
}
println!("GitHub CLI is not authenticated. Launching `gh auth login`...");
// Run `gh auth login` interactively
let login_status = Command::new("gh")
.args(["auth", "login", "--git-protocol", "https"])
.status()
.map_err(|_| anyhow::anyhow!("Failed to run `gh auth login`"))?;
if !login_status.success() {
Err(anyhow::anyhow!("Failed to authenticate using GitHub CLI."))
} else {
Ok(())
}
}View on GitHub (pinned to 3810898a74)
Solutions
- Install GitHub CLI: `brew install gh` (macOS), `winget install GitHub.cli` (Windows), or see cli.github.com; then restart the shell so PATH picks it up
- Verify with `command -v gh && gh --version` in the same environment goose runs in (especially CI/cron where PATH differs)
- If gh is installed but not found, add its install location to PATH or invoke goose from a shell where `gh` resolves
Defensive patterns
Strategy: validation
Validate before calling
# Pre-flight check in the same shell/environment goose will use command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1 \ && echo "gh ready" || echo "install gh and authenticate"
Prevention
- Install GitHub CLI and re-hash PATH (restart shell) before goose sessions that use GitHub recipes
- In CI, add an explicit setup-gh step and run `gh auth status` before invoking goose
- Avoid static-message masking in your own code: keep the underlying io::Error in the message
When it happens
Trigger: std::process::Command::new("gh").status() fails: no `gh` binary in PATH (ErrorKind::NotFound), exec permission denied, or exec format error. Triggered by any GitHub-recipe flow (run/list with GOOSE_RECIPE_GITHUB_REPO set).
Common situations: Fresh machine without GitHub CLI installed, `gh` installed via Homebrew but in a non-interactive shell PATH (cron, CI, launchd), or a broken gh installation (partial upgrade, wrong architecture binary).
Related errors
- Failed to run `gh auth login`
- Failed to clone repo: {}
- Failed to fetch repository contents using 'gh api' command (
- Failed to check directory contents: {}
- Failed to authenticate using GitHub CLI.
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/e2dac3e851576e80.
Report an issue: GitHub.