{"record":{"id":"87bc9ad391b5bfc7","repo":"zed-industries/zed","slug":"could-not-find-gdb-path-or-it-s-not-installed","errorCode":null,"errorMessage":"Could not find gdb path or it's not installed","messagePattern":"Could not find gdb path or it's not installed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dap_adapters/src/gdb.rs","lineNumber":208,"sourceCode":"            .and_then(|v| v.as_str())\n            .map(|s| s.to_string());\n\n        let gdb_path = if let Some(path) = gdb_path_from_config {\n            path\n        } else {\n            // Original logic: use user_installed_path or search in system path\n            let user_setting_path = user_installed_path\n                .filter(|p| p.exists())\n                .and_then(|p| p.to_str().map(|s| s.to_string()));\n\n            let gdb_path_result = delegate\n                .which(OsStr::new(\"gdb\"))\n                .await\n                .and_then(|p| p.to_str().map(|s| s.to_string()))\n                .context(\"Could not find gdb in path\");\n\n            if gdb_path_result.is_err() && user_setting_path.is_none() {\n                bail!(\"Could not find gdb path or it's not installed\");\n            }\n\n            user_setting_path.unwrap_or_else(|| gdb_path_result.unwrap())\n        };\n\n        // Arguments: use gdb_args from config if present, else user_args, else default\n        let gdb_args = {\n            let args = config\n                .config\n                .get(\"gdb_args\")\n                .and_then(|v| v.as_array())\n                .map(|arr| {\n                    arr.iter()\n                        .filter_map(|v| v.as_str().map(|s| s.to_string()))\n                        .collect::<Vec<_>>()\n                })\n                .or(user_args.clone())\n                .unwrap_or_else(|| vec![\"-i=dap\".into()]);","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/dap_adapters/src/gdb.rs#L190-L226","documentation":"gdb adapter resolution: Zed first tries the user-configured binary path (kept only if it exists on disk) and in parallel runs which('gdb'). If which() fails and no valid user path exists, this bail fires - neither an explicit path nor a discoverable gdb on PATH. The which() failure itself was already wrapped with context 'Could not find gdb in path'; this is the combined verdict.","triggerScenarios":"Starting a gdb debug session when gdb is not installed, is installed but not on PATH (non-login shells, snap/flatpak wrappers), or the user setting's path points to a nonexistent location. Note the user path is filtered by p.exists(), so a stale configured path silently falls back to PATH lookup.","commonSituations":"Fresh machines without build tools; gdb installed via Homebrew but PATH not updated (especially /opt/homebrew/bin on Apple Silicon); remote/container dev environments lacking gdb; typo'd absolute path in settings; gdb present only inside a container while Zed runs on the host.","solutions":["Install gdb (apt install gdb / brew install gdb) and ensure it is on PATH","Set the adapter's user binary path to the absolute gdb location (verify with `which gdb`)","For containers/remote environments, install gdb inside the same environment Zed's adapter runs in","On macOS, codesign gdb after install if signing errors follow"],"exampleFix":"// before: relies on PATH\n\"debug\": { \"adapters\": { \"lldb\": { \"binary\": { \"path\": \"/no/such/gdb\" } } } }\n\n// after: verify existence before starting a session\nlet gdb = which::which(\"gdb\").or_else(|_| {\n    let p = std::path::PathBuf::from(\"/opt/homebrew/bin/gdb\");\n    if p.exists() { Ok(p) } else { Err(anyhow::anyhow!(\"gdb not found\")) }\n})?;","handlingStrategy":"validation","validationCode":"// Resolve gdb up front with a clear failure instead of at session start\nlet gdb_path = user_installed_path\n    .filter(|p| p.exists())\n    .or_else(|| which::which(\"gdb\").ok())\n    .with_context(|| \"gdb not found: install it or set an absolute path in the adapter config\")?;","typeGuard":"fn gdb_available(configured: Option<&std::path::Path>) -> bool {\n    configured.map(|p| p.exists()).unwrap_or_else(|| which::which(\"gdb\").is_ok())\n}","tryCatchPattern":null,"preventionTips":["Pre-flight check `which gdb` (and the configured absolute path) before starting a session","On macOS/Homebrew, confirm /opt/homebrew/bin (or /usr/local/bin) is on PATH for GUI launches"],"tags":["dap","gdb","executable-not-found","path","install","rust"],"backgroundTag":"executable-not-found","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}