Open
Description
#!stacks
"sigpanic" && "cache.(*Snapshot).GoCommandInvocation:+5"
Issue created by stacks.
func (s *Snapshot) GoCommandInvocation(allowNetwork AllowNetwork, dir, verb string, args []string, env ...string) (_ *gocommand.Invocation, cleanup func(), _ error) {
inv := &gocommand.Invocation{
Verb: verb,
Args: args,
WorkingDir: dir,
Env: append(s.view.Env(), env...), // <--- nil deref
called from here:
func (c *commandHandler) Vendor(ctx context.Context, args command.URIArg) error {
return c.run(ctx, commandConfig{ ...
}, func(ctx context.Context, deps commandDeps) error
...
inv, cleanupInvocation, err := deps.snapshot.GoCommandInvocation(cache.NetworkOK, args.URI.DirPath(), "mod", []string{"vendor"})
The crash implies that either deps.snapshot or deps.snapshot.view is nil. The first cannot be the case because of the early return in c.run. The second cannot be the case because it's an immutable field of Snapshot that is non-nil at construction. So I think this is yet another case of memory corruption.
This stack wY83jw
was reported by telemetry:
crash/crash
runtime.gopanic:+69
runtime.panicmem:=262
runtime.sigpanic:+19
golang.org/x/tools/gopls/internal/cache.(*Snapshot).GoCommandInvocation:+5
golang.org/x/tools/gopls/internal/server.(*commandHandler).Vendor.func1:+10
golang.org/x/tools/gopls/internal/server.(*commandHandler).run.func2:+3
golang.org/x/tools/gopls/internal/server.(*commandHandler).run:+81
golang.org/x/tools/gopls/internal/server.(*commandHandler).Vendor:+1
golang.org/x/tools/gopls/internal/protocol/command.Dispatch:+226
golang.org/x/tools/gopls/internal/server.(*server).ExecuteCommand:+28
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+674
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0
golang.org/x/tools/gopls@v0.18.1 go1.24.0 darwin/arm64 neovim,vscode (5)
Metadata
Metadata
Assignees
Labels
Issues describing a possible bug in the Go implementation.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.This label describes issues relating to any tools in the x/tools repository.Issues related to the Go language server, gopls."can't happen" gopls crashes (races, unsafe, miscompile, runtime bugs, faulty HW)