{"record":{"id":"3c7de0700072a237","repo":"zed-industries/zed","slug":"failed-to-install-dlv-via-go-install-stdout","errorCode":null,"errorMessage":"failed to install dlv via `go install`. stdout: {:?}, stderr: {:?}\n Please try installing it manually using 'go install github.com/go-delve/delve/cmd/dlv@latest'","messagePattern":"failed to install dlv via `go install`\\. stdout: (.+?), stderr: (.+?)\n Please try installing it manually using 'go install github\\.com/go-delve/delve/cmd/dlv@latest'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dap_adapters/src/go.rs","lineNumber":474,"sourceCode":"        } else if delegate.fs().is_file(&dlv_path).await {\n            dlv_path.to_string_lossy().into_owned()\n        } else {\n            let go = delegate\n                .which(OsStr::new(\"go\"))\n                .await\n                .context(\"Go not found in path. Please install Go first, then Dlv will be installed automatically.\")?;\n\n            let adapter_path = paths::debug_adapters_dir().join(&Self::ADAPTER_NAME);\n\n            let install_output = util::command::new_command(&go)\n                .env(\"GO111MODULE\", \"on\")\n                .env(\"GOBIN\", &adapter_path)\n                .args(&[\"install\", \"github.com/go-delve/delve/cmd/dlv@latest\"])\n                .output()\n                .await?;\n\n            if !install_output.status.success() {\n                bail!(\n                    \"failed to install dlv via `go install`. stdout: {:?}, stderr: {:?}\\n Please try installing it manually using 'go install github.com/go-delve/delve/cmd/dlv@latest'\",\n                    String::from_utf8_lossy(&install_output.stdout),\n                    String::from_utf8_lossy(&install_output.stderr)\n                );\n            }\n\n            adapter_path\n                .join(&dlv_binary)\n                .to_string_lossy()\n                .into_owned()\n        };\n\n        let cwd = Some(\n            task_definition\n                .config\n                .get(\"cwd\")\n                .and_then(|s| s.as_str())\n                .map(PathBuf::from)","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/dap_adapters/src/go.rs#L456-L492","documentation":"The Go adapter's fallback installer: after locating a go binary via which(), it runs `go install github.com/go-delve/delve/cmd/dlv@latest` with GOBIN pointed at Zed's debug-adapters directory. If the command's exit status is unsuccessful, Zed bails with both captured stdout and stderr plus a hint to install dlv manually. The message tells you go exists but the module install itself failed.","triggerScenarios":"First Go debug session on a machine with Go installed but module download broken: no network / blocked GOPROXY, go version too old for @latest delve (build errors in stderr), GONOSUMDB/GOSUMDB verification failures, GOFLAGS injecting conflicting flags, or permission problems writing to the GOBIN directory.","commonSituations":"Corporate networks blocking proxy.golang.org; ancient Go toolchains (delve needs recent Go); GOPROXY=off or private-module configs; read-only or full disk for the adapters dir; SELinux/apparmor denying exec-write in the install dir.","solutions":["Read the embedded stderr - it is the actual go build/module error","Install manually as the message suggests: `go install github.com/go-delve/delve/cmd/dlv@latest`, then place dlv where the adapter expects it","Upgrade Go if stderr shows syntax/build errors from an old toolchain","Fix module fetching: check GOPROXY/GOFLAGS/GOSUMDB and network egress to proxy.golang.org"],"exampleFix":"// before: rely on Zed's automatic install\n// (fails with 'failed to install dlv via `go install`')\n\n// after: install manually and point Zed at it\ngo install github.com/go-delve/delve/cmd/dlv@latest\n# then in Zed's Go debug adapter settings set the binary path, e.g.:\n# \"go\": { \"binary\": { \"path\": \"$(go env GOPATH)/bin/dlv\" } }","handlingStrategy":"fallback","validationCode":"// Check dlv presence first; skip the auto-installer entirely when present\nlet dlv = paths::debug_adapters_dir().join(\"go/dlv\");\nif !dlv.exists() {\n    ensure_network_to(\"proxy.golang.org:443\").await?;\n    ensure_go_version_at_least(\"1.21\").await?;\n}","typeGuard":null,"tryCatchPattern":"match install_dlv_via_go(/* .. */).await {\n    Ok(path) => Ok(path),\n    Err(err) if err.to_string().contains(\"failed to install dlv\") => {\n        // fall back to a user-installed dlv on PATH\n        which::which(\"dlv\").map_err(|e| err.context(e.to_string()))\n    }\n    Err(err) => Err(err),\n}","preventionTips":["Install dlv manually once (go install github.com/go-delve/delve/cmd/dlv@latest) and reference it in settings","Keep the Go toolchain current; @latest delve needs a recent compiler","Verify module proxy reachability (GOPROXY, GOSUMDB, network egress) on locked-down machines"],"tags":["dap","go","delve","install","toolchain","rust"],"backgroundTag":"package-install-failed","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"}