#!stacks
"sigpanic" && "server.(*server).DidCreateFiles:+20"
Issue created by stacks.
// NewFile returns a document change to complete an empty go file.
func NewFile(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (*protocol.DocumentChange, error) {
if bs, err := fh.Content(); err != nil || len(bs) != 0 {
return nil, err <----------- may return no result and no error
}
meta, err := snapshot.NarrowestMetadataForFile(ctx, fh.URI())
if err != nil {
return nil, err
}
@xieyuschen
This stack WhZjCw
was reported by telemetry:
crash/crash
runtime.gopanic:+69,+0x153
runtime.panicmem:=262,+0x2ff
runtime.sigpanic:+19,+0x2cc
golang.org/x/tools/gopls/internal/server.(*server).DidCreateFiles:+20,+0x1b0
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+650,+0x2d87
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func4:+5,+0x73
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func5:+52,+0x68f
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2,+0xbf
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3,+0x8f
runtime.goexit:+0,+0x3
golang.org/x/tools/gopls@v0.19.0-pre.2 go1.24.3 darwin/arm64 vscode (2)
golang.org/x/tools/gopls@v0.19.0-pre.1 go1.24.3 darwin/arm64 other (9)
golang.org/x/tools/gopls@v0.19.0-pre.2 go1.24.3 darwin/arm64 other (1)
Dups: 6JFvKA
Comment From: adonovan
Let's cherrypick a fix for this into rc3.
Comment From: adonovan
This stack 6JFvKA
was reported by telemetry:
crash/crash
runtime.gopanic:+69,+0x167
runtime.panicmem:=262,+0x358
runtime.sigpanic:+19,+0x328
golang.org/x/tools/gopls/internal/server.(*server).DidCreateFiles:+20,+0x215
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+650,+0x36db
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func4:+5,+0x84
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func5:+52,+0x908
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2,+0xc5
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3,+0x95
runtime.goexit:+0,+0x0
golang.org/x/tools/gopls@v0.19.0-pre.2 go1.24.3 linux/amd64 vscode (1)
golang.org/x/tools/gopls@v0.19.0-pre.2 go1.24.3 darwin/amd64 vscode-insiders (1)
golang.org/x/tools/gopls@v0.19.0-pre.1 go1.24.3 linux/amd64 vscode (1)
Comment From: gabyhelp
Related Issues
- x/tools/gopls: Completion: nil deref in expectedCompositeLiteralType #72136 (closed)
- x/tools/gopls: nil Signature (?) deref in Completion #70634 (closed)
- x/tools/gopls: nil deref in Snapshot.MetadataForFile #73114
- x/tools/gopls: nil deref panic in go.test code action #72907 (closed)
- x/tools/gopls: nil deref in 'go vendor' Snapshot.GoCommandInvocation #73891
- x/tools/gopls: nil deref in x/telemetry/internal/counter.(*Counter).add #73890
- x/tools/gopls: Hover: nil deref in parseDocLink #70635 (closed)
- x/tools/gopls: Completion: nil deref panic in addFieldItems #72828 (closed)
- x/tools/gopls: OOB index crash in completion.expectedReturnStmtType #70636 (closed)
- x/tools/gopls: Package.Path called on nil Package in AddTestForFunc #73687 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: gopherbot
Change https://go.dev/cl/680259 mentions this issue: gopls/internal/golang/completion: return error if file is not new