#!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:

golang.org/x/tools/gopls@v0.18.1 go1.24.0 darwin/arm64 neovim,vscode (5)

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)