GitoxideLabs/gitoxide · error
At least one operation failed
Error message
At least one operation failed
What it means
The `discover` CLI plumbing command prints results of several discovery operations (`gix::discover::upwards` etc.). Each `print_result` records whether any operation failed via `has_err`; if at least one failed, the command exits non-zero with this generic aggregate error after having already printed the individual errors to stdout.
Solutions
- Read the individual operation errors printed above the final message — the real cause is there.
- Verify the given path exists and lies inside a git repository (or run `git init`).
- Check filesystem permissions on the target directory.
- Fix the underlying discovery failure (e.g. repair a broken `.git` link) and re-run.
Defensive patterns
Strategy: validation
Validate before calling
let target = std::path::Path::new(repo);
if !target.is_dir() {
eprintln!("{repo:?} is not a directory");
std::process::exit(2);
}
// optional pre-check that a repository is discoverable
if gix::discover::is_git(target).is_err() {
eprintln!("warning: no git repository found at or above {repo:?}");
} Try / catch
match discover(&mut out, repo) {
Err(e) if e.to_string().contains("At least one operation failed") => {
eprintln!("see printed per-operation errors above for the cause");
}
other => other?,
} Prevention
- Confirm the target path is inside a git repository before running discover.
- Check read permissions on the target directory.
- Inspect the printed operation results; the aggregate message is only a summary.
When it happens
Trigger: Running `gix discover <path>` when the path is not inside a git repository, is inaccessible, or one of the printed discovery variants (e.g. upwards discovery) returns Err — the details appear in the printed output above the final message.
Common situations: Pointing `gix discover` at a bare directory outside any work tree, running it in a directory the user lacks permission to read, or a `.git` file pointing to an invalid location so upwards discovery fails.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- Cannot run without any task to perform on the repositories
- No commits to process
- Refusing to checkout index into existing directory
- Cannot print information using 'human' format.
- JSON output isn't supported
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/2bfd6d1cd8296961.
Report an issue: GitHub.
Appendix: source
Thrown at gitoxide-core/src/discover.rs:29
if has_err {
writeln!(out, "open (lenient) {}:", repo.display())?;
has_err |= print_result(
&mut out,
gix::open_opts(repo, gix::open::Options::default().strict_config(false)),
)?;
}
writeln!(out)?;
writeln!(out, "discover from {}:", repo.display())?;
has_err |= print_result(&mut out, gix::discover(repo))?;
writeln!(out)?;
writeln!(out, "discover (plumbing) from {}:", repo.display())?;
has_err |= print_result(&mut out, gix::discover::upwards(repo))?;
if has_err {
writeln!(out)?;
anyhow::bail!("At least one operation failed")
}
Ok(())
}
fn print_result<T, E>(mut out: impl std::io::Write, res: Result<T, E>) -> std::io::Result<bool>
where
T: std::fmt::Debug,
E: std::error::Error + Send + Sync + 'static,
{
let mut has_err = false;
let to_print = match res {
Ok(good) => {
format!("{good:#?}")
}
Err(err) => {
has_err = true;
format!("{:?}", anyhow::Error::from(err))View on GitHub (pinned to e73179060b)