gitbutlerapp/gitbutler · error

Errors occurred

Error message

Errors occurred: {cmd_errors:?}

What it means

This error is raised when one or more external commands fail to execute (or exit unsuccessfully) during the multi-command run loop in but-path's editor-opening helper. The library accumulates an error per failed command and bails once, reporting all of them together. It signals that none of the attempted commands could be run, so the intended action (e.g. opening an editor/path handler) did not happen.

Solutions

  1. Check that the reported commands exist on PATH (`which <cmd>`) and install or fix them
  2. Set a working $EDITOR/$BROWSER environment variable for the platform
  3. Run the command manually with the same arguments to see the underlying spawn/exec failure
  4. If running in a container/CI, install the platform opener package (e.g. xdg-utils) or bypass opening

Example fix

// before (no editor available)
let _ = but_path::open(&path);
// after (verify an opener exists first)
let opener = std::env::var("EDITOR").unwrap_or_else(|_| "xdg-open".into());
assert!(which::which(&opener).is_ok(), "no opener '{opener}' on PATH");
but_path::open(&path)?;
Defensive patterns

Strategy: try-catch

Validate before calling

let opener = std::env::var("EDITOR").unwrap_or_else(|_| "xdg-open".into());
if which::which(&opener).is_err() { eprintln!("opener '{opener}' not on PATH"); }

Try / catch

match but_path::open(&path) {
    Ok(()) => {},
    Err(e) if e.to_string().contains("Errors occurred") => {
        eprintln!("no opener available: {e}; install xdg-utils or set $EDITOR");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `open` (via but_path::open / Open::open) when every candidate command in the loop fails to spawn or execute — e.g. the configured editor binary does not exist, the platform-specific opener is missing, or the command returns non-zero.

Common situations: Developers on minimal/containerized environments without xdg-open/open/start or a configured $EDITOR; a typo'd editor config; PATH not containing the opener binary; sandboxed systems blocking process spawn.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/bd815a083991dec8. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-path/src/lib.rs:319

            // process effectively just sends the deep link to the already running GUI and then
            // exits.
            cmd.spawn()?;
        };

        #[cfg(not(target_os = "linux"))]
        {
            let mut cmd_errors = Vec::new();
            for mut cmd in open::commands(url.as_str()) {
                cmd.envs(cleaned_vars.clone());
                cmd.current_dir(env::temp_dir());
                if cmd.status().is_ok() {
                    return Ok(());
                } else {
                    cmd_errors.push(anyhow::anyhow!("Failed to execute command {cmd:?}"));
                }
            }
            if !cmd_errors.is_empty() {
                anyhow::bail!("Errors occurred: {cmd_errors:?}");
            }
        }
        Ok(())
    }
}

fn build_open_url(
    scheme: &str,
    possibly_project_dir: &std::path::Path,
    timestamp: u128,
    new_window: bool,
) -> anyhow::Result<url::Url> {
    let mut url = url::Url::parse(&format!("{scheme}://open"))?;
    url.query_pairs_mut()
        .append_pair("path", &possibly_project_dir.to_string_lossy())
        .append_pair("t", &timestamp.to_string())
        .append_pair("new_window", if new_window { "1" } else { "0" });
    Ok(url)

View on GitHub (pinned to 58e5313667)