gitbutlerapp/gitbutler · warning

'dot' (graphviz) must be installed on the system

Error message

'dot' (graphviz) must be installed on the system

What it means

A panic (expect) in but-graph's debug visualization: spawning the external `dot` executable (Graphviz) failed, so the SVG debug-graph file cannot be produced. This code runs from tests/debug helpers that render the commit graph, and it assumes Graphviz is installed on PATH.

Solutions

  1. Install Graphviz (e.g. `brew install graphviz`, `apt install graphviz`, or the Windows installer).
  2. Ensure `dot --version` works in the same environment the tests run in (CI PATH often differs from your shell).
  3. Skip the SVG-producing debug path when visualization is not needed, if the API offers a toggle.

Example fix

# before: CI fails with "'dot' (graphviz) must be installed on the system"
# after: add to CI setup
apt-get update && apt-get install -y graphviz
dot -V
Defensive patterns

Strategy: validation

Validate before calling

# fail fast with a clear message instead of a panic mid-test
command -v dot >/dev/null 2>&1 || { echo "graphviz (dot) not installed" >&2; exit 2; }

Prevention

When it happens

Trigger: Running but-graph debug/snapshot tests or debug output that calls the SVG writer on a machine without the graphviz package; PATH not including the directory containing `dot` in the test environment/CI.

Common situations: Fresh dev machines or minimal CI containers missing graphviz; nix/homebrew environments where graphviz is not in the shell's PATH for the test process; Windows without Graphviz installed.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/7a2399b1008baa0d. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-graph/src/debug.rs:372

    #[tracing::instrument(skip(self))]
    pub fn open_as_svg(&self) {
        use std::{io::Write, process::Stdio, sync::atomic::AtomicUsize};

        static SUFFIX: AtomicUsize = AtomicUsize::new(0);
        let suffix = SUFFIX.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
        let svg_name = format!("debug-graph-{suffix:02}.svg");
        let svg_path = std::env::var_os("CARGO_MANIFEST_DIR")
            .map(std::path::PathBuf::from)
            .unwrap_or_default()
            .join(svg_name);
        let mut dot = std::process::Command::new("dot")
            .args(["-Tsvg", "-o"])
            .arg(&svg_path)
            .stdin(Stdio::piped())
            .stdout(Stdio::piped())
            .stderr(Stdio::piped())
            .spawn()
            .expect("'dot' (graphviz) must be installed on the system");
        dot.stdin
            .as_mut()
            .unwrap()
            .write_all(self.dot_graph_pruned().as_bytes())
            .ok();
        let mut out = dot.wait_with_output().unwrap();
        out.stdout.extend(out.stderr);
        assert!(
            out.status.success(),
            "dot failed: {out}",
            out = out.stdout.as_bstr()
        );

        assert!(
            std::process::Command::new("open")
                .arg(&svg_path)
                .status()
                .unwrap()

View on GitHub (pinned to caf1f223d3)