golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.91k stars 17.65k forks source link

x/tools/gopls: "nil metadata for %q" panic in Snapshot.getPackageHandles (reported by telemetry) #66144

Open adonovan opened 8 months ago

adonovan commented 8 months ago

This stack j8z9tw was reported by telemetry:

getPackageHandles.func1:+6 is:

            if mp == nil {
                panic(fmt.Sprintf("nil metadata for %q", id))
            }
crash/crash
runtime.gopanic:+69
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func1:+6
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func1:+23
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles:+48
golang.org/x/tools/gopls/internal/cache.(*Snapshot).forEachPackage:+8
golang.org/x/tools/gopls/internal/cache.(*Snapshot).PackageDiagnostics:+28
golang.org/x/tools/gopls/internal/cache.(*Snapshot).orphanedFileDiagnostics:+31
golang.org/x/tools/gopls/internal/cache.(*Session).OrphanedFileDiagnostics:+50
golang.org/x/tools/gopls/internal/server.(*server).diagnoseChangedViews:+54
golang.org/x/tools/gopls/internal/server.(*server).didModifyFiles.func2:+1
runtime.goexit:+0
golang.org/x/tools/gopls@v0.15.1 devel linux/amd64 coc.nvim (4)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

findleyr commented 1 week ago

We're not going to be able to fix this until we have crash reporting again (broken in v0.16.2). Maybe we'll get signal from the v0.17.0 prerelease, but I'll plan this for v0.18.0.