{"record":{"id":"7a2399b1008baa0d","repo":"gitbutlerapp/gitbutler","slug":"dot-graphviz-must-be-installed-on-the-system","errorCode":null,"errorMessage":"'dot' (graphviz) must be installed on the system","messagePattern":"'dot' \\(graphviz\\) must be installed on the system","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-graph/src/debug.rs","lineNumber":372,"sourceCode":"    #[tracing::instrument(skip(self))]\n    pub fn open_as_svg(&self) {\n        use std::{io::Write, process::Stdio, sync::atomic::AtomicUsize};\n\n        static SUFFIX: AtomicUsize = AtomicUsize::new(0);\n        let suffix = SUFFIX.fetch_add(1, std::sync::atomic::Ordering::SeqCst);\n        let svg_name = format!(\"debug-graph-{suffix:02}.svg\");\n        let svg_path = std::env::var_os(\"CARGO_MANIFEST_DIR\")\n            .map(std::path::PathBuf::from)\n            .unwrap_or_default()\n            .join(svg_name);\n        let mut dot = std::process::Command::new(\"dot\")\n            .args([\"-Tsvg\", \"-o\"])\n            .arg(&svg_path)\n            .stdin(Stdio::piped())\n            .stdout(Stdio::piped())\n            .stderr(Stdio::piped())\n            .spawn()\n            .expect(\"'dot' (graphviz) must be installed on the system\");\n        dot.stdin\n            .as_mut()\n            .unwrap()\n            .write_all(self.dot_graph_pruned().as_bytes())\n            .ok();\n        let mut out = dot.wait_with_output().unwrap();\n        out.stdout.extend(out.stderr);\n        assert!(\n            out.status.success(),\n            \"dot failed: {out}\",\n            out = out.stdout.as_bstr()\n        );\n\n        assert!(\n            std::process::Command::new(\"open\")\n                .arg(&svg_path)\n                .status()\n                .unwrap()","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/2497b8007aa4a1922dae9a805b32ffe5b5037785/crates/but-graph/src/debug.rs#L354-L390","documentation":"Panic while rendering the debug SVG of the commit graph: spawning the external 'dot' executable failed and the code expects Graphviz to be installed. A spawn failure here is almost always ENOENT - the 'dot' binary is absent from the PATH of the running process. The output file (debug-graph-NN.svg, written next to CARGO_MANIFEST_DIR when set) is never produced.","triggerScenarios":"Running the but-graph debug SVG output on a machine without Graphviz; CI images that lack the graphviz package; GUI- or IDE-launched processes whose inherited PATH omits /opt/homebrew/bin or the Graphviz install directory; distroless/scratch containers.","commonSituations":"Fresh developer machines; macOS Homebrew Graphviz invisible to non-shell parent processes; minimal Docker images used for reproducible test runs.","solutions":["Install Graphviz: 'brew install graphviz' (macOS), 'sudo apt install graphviz' (Debian/Ubuntu), 'choco install graphviz' (Windows)","Confirm 'dot' resolves in the same environment that runs the command: 'which dot'","For GUI-launched processes, extend PATH in the launcher or invoke via a shell that has Graphviz on PATH"],"exampleFix":"// before\nlet mut dot = std::process::Command::new(\"dot\").args([\"-Tsvg\", \"-o\"])\n    .arg(&svg_path) /* ... */ .spawn()\n    .expect(\"'dot' (graphviz) must be installed on the system\");\n\n// after\nlet mut dot = std::process::Command::new(\"dot\").args([\"-Tsvg\", \"-o\"])\n    .arg(&svg_path) /* ... */ .spawn()\n    .map_err(|e| anyhow::anyhow!(\"SVG debug output needs Graphviz ('dot') on PATH; install it or fix PATH: {e}\"))?;","handlingStrategy":"validation","validationCode":"// Check for dot on PATH before entering code that renders SVG debug output\nlet dot_found = std::env::var_os(\"PATH\")\n    .map(|paths| {\n        std::env::split_paths(&paths).any(|dir| dir.join(\"dot\").exists())\n    })\n    .unwrap_or(false);\nif !dot_found {\n    anyhow::bail!(\"SVG debug output requires Graphviz; install it or skip --svg\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add graphviz to CI images and dev-container definitions where graph debugging runs","For GUI-launched processes, verify the launcher's PATH actually contains the Graphviz bin dir","Keep a non-SVG (text/dot-source) output mode as the fallback when dot is unavailable"],"tags":["rust","panic","graphviz","external-tool","path","debug-tooling"],"backgroundTag":"missing-system-dependency","analyzedSha":"2497b8007aa4a1922dae9a805b32ffe5b5037785","analyzedAt":"2026-08-17T00:30:25.648Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}