zed icon indicating copy to clipboard operation
zed copied to clipboard

Could not install the Go language server 'gopls', because 'Go' was not found

Open Arkady-Dymkov opened this issue 10 months ago • 4 comments

Summary

Zed cannot correctly detect or launch existing system gopls despite valid Go and gopls installations.

Description

Even when Go and gopls are fully installed, configured, and verified working inside Zed's own terminal shell, Zed fails with the error:

Could not install the Go language server "gopls", because "Go" was not found.

However:

  • go version works correctly inside Zed.
  • gopls version works correctly inside Zed.
  • gopls is correctly installed and executable (Mach-O arm64).
  • Manual override in settings.json still fails.
  • No LSP connection logs are created (Developer: Show LSP Logs is empty).

It appears Zed incorrectly sets environment variables or fails to correctly launch language servers using custom environment paths.

Steps to reproduce:

  1. Install Go manually under a custom $GOROOT (e.g., $HOME/go/go-installation) and set $GOROOT, $GOPATH in .zshrc.
  2. Install gopls manually: go install golang.org/x/tools/gopls@latest
  3. Confirm in Zed’s Shell: Open in Terminal that both go version and gopls version work.
  4. Add to settings.json:
"lsp": {
  "gopls": {
    "command": "/Users/Arkadiy.Dymkov/go/bin/gopls",
    "initialization_options": {
      "usePlaceholders": true,
      "completeUnimported": true
    }
  }
}
  1. Restart Zed and open any .go file.

Expected Behavior:

  • Zed detects the manually installed gopls and connects normally.
  • LSP features (autocomplete, hover, go-to-definition) work.

Actual Behavior:

  • Zed shows startup error: "Could not install the Go language server 'gopls', because 'Go' was not found."
  • No LSP logs are created.

Manual gopls command works outside of Zed.

Additional: ZED settongs.json:

{
  "languages": {
    "Go": {
      "language_servers": ["gopls"],
      "format_on_save": "on",
      "code_actions_on_format": {
        "source.organizeImports": true
      }
    }
  },
  "lsp": {
    "gopls": {
      "command": "/Users/Arkadiy.Dymkov/go/bin/gopls",
      "initialization_options": {
        "usePlaceholders": true,
        "completeUnimported": true,
        "experimentalPostfixCompletions": true,
        "hints": {
          "assignVariableTypes": false,
          "compositeLiteralFields": false,
          "compositeLiteralTypes": false,
          "constantValues": true,
          "functionTypeParameters": true,
          "parameterNames": true,
          "rangeVariableTypes": true
        }
      }
    }
  },
  "project_panel": {
    "dock": "right"
  },
  "assistant": {
    "dock": "left",
    "default_model": {
      "provider": "zed.dev",
      "model": "claude-3-7-sonnet-thinking-latest"
    },
    "version": "2"
  },
  "theme": {
    "mode": "system",
    "light": "One Light",
    "dark": "Tomorrow Dark"
  }
}
zed $ which go
/Users/Arkadiy.Dymkov/go/go-installation/bin/go

zed $ go version
go version go1.24.2 darwin/arm64

zed $ which gopls
/Users/Arkadiy.Dymkov/go/bin/gopls

zed $ gopls version
golang.org/x/tools/gopls v0.18.1

Zed Version and System Specs

Zed: v0.183.11 (Zed) OS: macOS 15.3.2 Memory: 32 GiB Architecture: aarch64

Arkady-Dymkov avatar Apr 28 '25 10:04 Arkady-Dymkov

Also i started to recieve

Error loading workspace folders (expected 1, got 0)
failed to load view for file:///Users/Arkadiy.Dymkov/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go: err: fork/exec /Users/Arkadiy.Dymkov/go/go-installation/bin/go: not a directory: stderr: 

Arkady-Dymkov avatar May 05 '25 10:05 Arkady-Dymkov

Thanks for reporting. Likely the same issue as #25404 and likely caused by #22575

Are you launching Zed via the app menu or via the command line?

probably-neb avatar May 06 '25 15:05 probably-neb

Hey, @probably-neb! Via app menu

Arkady-Dymkov avatar May 12 '25 10:05 Arkady-Dymkov

When I start zed as app the error occurs again. Without error when starting the zed cli. Possible merged PR https://github.com/zed-industries/zed/pull/31799

2025-06-04T13:30:42+02:00 ERROR [zed] login shell exited with exit status: 1. stdout: "", stderr: "bash: Kann die Prozessgruppe des Terminals nicht setzen (-1).: Unpassender IOCTL (I/O-Control) für das Gerät\nbash: Keine Jobsteuerung in dieser Shell\nbash: /tmp/.tmpcxlSJ4: Kann existierende Datei nicht überschreiben.\n"
2025-06-04T13:30:43+02:00 WARN  [home] login shell exited with exit status: 1. stdout: "", stderr: "bash: Kann die Prozessgruppe des Terminals nicht setzen (-1).: Unpassender IOCTL (I/O-Control) für das Gerät\nbash: Keine Jobsteuerung in dieser Shell\nbash: /tmp/.tmpesSie1: Kann existierende Datei nicht überschreiben.\n"
2025-06-04T13:30:43+02:00 ERROR [project::environment] Failed to load environment variables. See log for details

mosenturm avatar Jun 04 '25 11:06 mosenturm

Yep, please once you've updated to v0.190.4 let us know if the issue is resolved!

probably-neb avatar Jun 11 '25 17:06 probably-neb

Yep, please once you've updated to v0.190.4 let us know if the issue is resolved!

Not resolved. See also https://github.com/zed-industries/zed/issues/32445#issuecomment-2963534903

Zed: v0.191.0 (Zed Dev 6d9bcdb2af603e1a3eee2531b1721550322d8f8d) OS: Linux Wayland ubuntu 24.04 Memory: 30.7 GiB Architecture: x86_64 GPU: AMD Radeon Graphics (RADV RENOIR) || radv || Mesa 24.2.8-1ubuntu1~24.04.1

mosenturm avatar Jun 11 '25 17:06 mosenturm

Hi, using Zed v0.191.4 and the problem still remains.

Zed: v0.191.4 (Zed) OS: Linux Wayland ubuntu 22.04 Memory: 31 GiB Architecture: x86_64 GPU: Intel(R) Graphics (RPL-U) || Intel open-source Mesa driver || Mesa 23.2.1-1ubuntu3.1~22.04.3

eduardohitek avatar Jun 18 '25 18:06 eduardohitek

Hi, using Zed v0.191.4 and the problem still remains.

Zed: v0.191.4 (Zed) OS: Linux Wayland ubuntu 22.04 Memory: 31 GiB Architecture: x86_64 GPU: Intel(R) Graphics (RPL-U) || Intel open-source Mesa driver || Mesa 23.2.1-1ubuntu3.1~22.04.3

It's solved with 0.192.x https://zed.dev/releases/preview/0.192.0

mosenturm avatar Jun 18 '25 19:06 mosenturm

observed at windows scoop zed-nightly

Zed: v0.194.0 (Zed Dev dfdeb1bf512bfbb446e48e70c48bb23210ee37ab) OS: Windows 10.0.26100 Memory: 15.7 GiB Architecture: x86_64 GPU: Intel(R) Iris(R) Xe Graphics || Intel Corporation || Intel driver

chanmaoganda avatar Jun 26 '25 06:06 chanmaoganda

Same error for 0.200.4 55ffbb43c8cdec2d923954fddf4a75cc771c26e2

soyayaos avatar Aug 21 '25 06:08 soyayaos

Can you confirm that both go and gopls are on the path in the Zed terminal @soyayaos and @chanmaoganda?

probably-neb avatar Aug 25 '25 16:08 probably-neb

@probably-neb After updating Ubuntu packages and Zed version to 0.200.5 the problem is gone.

soyayaos avatar Aug 25 '25 18:08 soyayaos

Ok, I'm going to close this then. Feel free to open new issues or comment on this one and we can reopen if the issue keeps happening

probably-neb avatar Aug 25 '25 20:08 probably-neb

Same problem: Zed: v0.210.0 (Zed Nightly 6c3a7f6ddb9746ed36c8b1397b5c63a6dd2f8a92) OS: Windows 10.0.26100 Memory: 31.6 GiB Architecture: x86_64 GPU: NVIDIA GeForce RTX 4050 Laptop GPU || NVIDIA Corporation || 555.97 r555_00

go version
go version go1.24.3 windows/amd64

gopls version
golang.org/x/tools/gopls v0.20.0

AleksandrVishniakov avatar Oct 18 '25 10:10 AleksandrVishniakov

this must be a windows specific issue, those who use linux perhaps may not encounter this issue

chanmaoganda avatar Oct 20 '25 06:10 chanmaoganda

my arch works perfect on zed with go

chanmaoganda avatar Oct 20 '25 06:10 chanmaoganda

It works now, but I had to reinstall Zed

AleksandrVishniakov avatar Oct 20 '25 06:10 AleksandrVishniakov