Skip to content

x/tools/gopls: panic applying critical error to empty files #54395

@okamotouci

Description

@okamotouci

gopls version: v0.9.2 (go1.19)
gopls flags:
update flags: proxy
extension version: 0.35.1
go version: 1.19
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Thu, 11 Aug 2022 12:37:21 GMT
restart history:
Thu, 11 Aug 2022 12:37:08 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: invalid start/end token.Pos

goroutine 144 [running]:
golang.org/x/tools/internal/span.NewRange(...)
	  token.go:33
golang.org/x/tools/internal/lsp/cache.(*snapshot).applyCriticalErrorToFiles(0xc0004168c0, {0x10c09a0, 0xc00088fdd0}, {0xea0771, 0x193}, {0xc0004762e0%3F, 0x1, 0xc0007bf570%3F})
	  load.go:383  0x58a
golang.org/x/tools/internal/lsp/cache.(*snapshot).workspaceLayoutError(0xc0004168c0, {0x10c09a0, 0xc00088fdd0})
	  load.go:330  0x20b
golang.org/x/tools/internal/lsp/cache.(*snapshot).GetCriticalError(0xc0004168c0, {0x10c09a0, 0xc00088fdd0})
	  snapshot.go:1391  0x2b6
golang.org/x/tools/internal/lsp.(*Server).diagnose(0xc0002206c0, {0x10c09a0, 0xc000539680}, {0x10cc4f8, 0xc0004168c0}, 0x0)
	  diagnostics.go:264  0xecd
golang.org/x/tools/internal/lsp.(*Server).diagnoseSnapshot(0xc0002206c0, {0x10cc4f8, 0xc0004168c0}, {0xc000112e90, 0x1, 0x1}, 0x88%3F)
	  diagnostics.go:153  0x2f1
golang.org/x/tools/internal/lsp.(*Server).diagnoseSnapshots.func1({0x10cc4f8%3F, 0xc0004168c0%3F}, {0xc000112e90%3F, 0xc0000f46a0%3F, 0xc0002b8fb8%3F})
	  diagnostics.go:130  0x85
created by golang.org/x/tools/internal/lsp.(*Server).diagnoseSnapshots
	  diagnostics.go:128  0x90
[Error - 9:37:14 PM] 

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions