zed-industries/zed · error · anyhow::Error

failed to install gopls with `go install`. Is `go` installed

Error message

failed to install gopls with `go install`. Is `go` installed and in the PATH? Check logs for more information.

What it means

The `go install golang.org/x/tools/gopls@latest` subprocess exited with a non-zero status, so gopls could not be built/installed into GOBIN; the failure is logged with stdout/stderr and surfaced as this error.

Source

Thrown at crates/languages/src/go.rs:173

                return Ok(path);
            }

            let gobin_dir = container_dir.join("gobin");
            fs::create_dir_all(&gobin_dir).await?;
            let install_output = util::command::new_command(go)
                .env("GO111MODULE", "on")
                .env("GOBIN", &gobin_dir)
                .args(["install", "golang.org/x/tools/gopls@latest"])
                .output()
                .await?;

            if !install_output.status.success() {
                log::error!(
                    "failed to install gopls via `go install`. stdout: {:?}, stderr: {:?}",
                    String::from_utf8_lossy(&install_output.stdout),
                    String::from_utf8_lossy(&install_output.stderr)
                );
                anyhow::bail!(
                    "failed to install gopls with `go install`. Is `go` installed and in the PATH? Check logs for more information."
                );
            }

            let installed_binary_path = gobin_dir.join(BINARY);
            let version_output = util::command::new_command(&installed_binary_path)
                .arg("version")
                .output()
                .await
                .context("failed to run installed gopls binary")?;
            let gopls_version = parse_version_output(&version_output)?;
            let binary_path = container_dir.join(format!("gopls_{gopls_version}_go_{go_version}"));
            fs::rename(&installed_binary_path, &binary_path).await?;

            Ok(LanguageServerBinary {
                path: binary_path.to_path_buf(),
                arguments: server_binary_arguments(),
                env: None,

View on GitHub (pinned to f4178619ac)

Solutions

  1. Verify `go` is installed and on PATH, then retry
  2. Run `go install golang.org/x/tools/gopls@latest` manually to see the real error
  3. Check network/proxy settings if module downloads fail
  4. Install gopls via the OS package manager and set the binary path in Zed settings
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/languages/src/go.rs:173 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/d884870693ca9dee. Report an issue: GitHub.