oraios/serena · error · RuntimeError

Go is not installed. Please install Go from https://golang.o

Error message

Go is not installed. Please install Go from https://golang.org/doc/install and make sure it is added to your PATH.

What it means

RuntimeError raised during Gopls.__init__ (via _setup_runtime_dependency) when the Go toolchain itself cannot be found. _get_go_version() (which shells out to `go version`) returned nothing, so gopls management cannot proceed. This is a hard prerequisite check before attempting any gopls operations.

Source

Thrown at src/solidlsp/language_servers/gopls.py:91

    @staticmethod
    def _get_gopls_version() -> str | None:
        """Get the installed gopls version or None if not found."""
        try:
            result = subprocess_run(["gopls", "version"], capture_output=True, text=True, check=False)
            if result.returncode == 0:
                return result.stdout.strip()
        except FileNotFoundError:
            return None
        return None

    @staticmethod
    def _setup_runtime_dependency() -> bool:
        """
        Check if required Go runtime dependencies are available.
        Raises RuntimeError with helpful message if dependencies are missing.
        """
        go_version = Gopls._get_go_version()
        if not go_version:
            raise RuntimeError(
                "Go is not installed. Please install Go from https://golang.org/doc/install and make sure it is added to your PATH."
            )

        gopls_version = Gopls._get_gopls_version()
        if not gopls_version:
            raise RuntimeError(
                "Found a Go version but gopls is not installed.\n"
                "Please install gopls as described in https://pkg.go.dev/golang.org/x/tools/gopls#section-readme\n\n"
                "After installation, make sure it is added to your PATH (it might be installed in a different location than Go)."
            )

        return True

    def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):
        self._setup_runtime_dependency()

        super().__init__(config, repository_root_path, ProcessLaunchInfo(cmd="gopls", cwd=repository_root_path), "go", solidlsp_settings)

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install Go from https://golang.org/doc/install and verify with `go version`
  2. Ensure the `go` binary directory (e.g. /usr/local/go/bin) is on PATH for the process running the library
  3. If using a version manager (gvm, asdf), activate the Go version in the target environment
  4. Point ls_path/go binary configuration at the absolute go binary path

Example fix

// before
which go  # not found
// after
# Linux example
sudo rm -rf /usr/local/go && curl -LO https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
Defensive patterns

Strategy: validation

Validate before calling

import shutil, subprocess
def ensure_go_toolchain():
    if shutil.which('go') is None:
        raise FileNotFoundError('Go not installed or not on PATH')
    subprocess.run(['go', 'version'], check=True, capture_output=True)

Prevention

When it happens

Trigger: Constructing the Gopls language server when `go version` fails or the `go` binary is absent from PATH.

Common situations: Go not installed on the machine/CI image; go installed via a version manager not active for the running process; PATH stripped in systemd/cron/IDE-spawned subprocesses.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/960f6912653aa129. Report an issue: GitHub.