{"record":{"id":"2bfd6d1cd8296961","repo":"GitoxideLabs/gitoxide","slug":"at-least-one-operation-failed","errorCode":null,"errorMessage":"At least one operation failed","messagePattern":"At least one operation failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/discover.rs","lineNumber":29,"sourceCode":"    if has_err {\n        writeln!(out, \"open (lenient) {}:\", repo.display())?;\n        has_err |= print_result(\n            &mut out,\n            gix::open_opts(repo, gix::open::Options::default().strict_config(false)),\n        )?;\n    }\n\n    writeln!(out)?;\n    writeln!(out, \"discover from {}:\", repo.display())?;\n    has_err |= print_result(&mut out, gix::discover(repo))?;\n\n    writeln!(out)?;\n    writeln!(out, \"discover (plumbing) from {}:\", repo.display())?;\n    has_err |= print_result(&mut out, gix::discover::upwards(repo))?;\n\n    if has_err {\n        writeln!(out)?;\n        anyhow::bail!(\"At least one operation failed\")\n    }\n\n    Ok(())\n}\n\nfn print_result<T, E>(mut out: impl std::io::Write, res: Result<T, E>) -> std::io::Result<bool>\nwhere\n    T: std::fmt::Debug,\n    E: std::error::Error + Send + Sync + 'static,\n{\n    let mut has_err = false;\n    let to_print = match res {\n        Ok(good) => {\n            format!(\"{good:#?}\")\n        }\n        Err(err) => {\n            has_err = true;\n            format!(\"{:?}\", anyhow::Error::from(err))","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/discover.rs#L11-L47","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let target = std::path::Path::new(repo);\nif !target.is_dir() {\n    eprintln!(\"{repo:?} is not a directory\");\n    std::process::exit(2);\n}\n// optional pre-check that a repository is discoverable\nif gix::discover::is_git(target).is_err() {\n    eprintln!(\"warning: no git repository found at or above {repo:?}\");\n}","typeGuard":null,"tryCatchPattern":"match discover(&mut out, repo) {\n    Err(e) if e.to_string().contains(\"At least one operation failed\") => {\n        eprintln!(\"see printed per-operation errors above for the cause\");\n    }\n    other => other?,\n}","preventionTips":["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."],"tags":["git","discovery","aggregate-error","cli"],"backgroundTag":"git-command-failed","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}