Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: Definitions bug "internal error: no position for %v" on error.Error method #64086

Closed
adonovan opened this issue Nov 12, 2023 · 1 comment
Assignees
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Nov 12, 2023

Another stack kkvfqw reported by telemetry:

golang.org/x/tools/gopls/internal/bug report:35
golang.org/x/tools/gopls/internal/bug Errorf:2
golang.org/x/tools/gopls/internal/lsp/source Definition:86
golang.org/x/tools/gopls/internal/lsp (*Server).definition:19
golang.org/x/tools/gopls/internal/lsp (*Server).Definition:1
golang.org/x/tools/gopls/internal/lsp/protocol serverDispatch:192
golang.org/x/tools/gopls/internal/lsp/lsprpc (*StreamServer).ServeStream.ServerHandler
golang.org/x/tools/gopls/internal/lsp/lsprpc (*StreamServer).ServeStream.handshaker
golang.org/x/tools/gopls/internal/lsp/protocol Handlers.MustReplyHandler
golang.org/x/tools/gopls/internal/lsp/protocol Handlers.AsyncHandler
runtime goexit:0
- golang.org/x/tools/gopls@v0.14.1 go1.21.3 linux/amd64 (1)
- golang.org/x/tools/gopls@v0.14.1 go1.21.0 linux/amd64 (1)

This is L108 of Defintion.go:

			return nil, bug.Errorf("internal error: no position for %v", obj.Name())

I can reproduce the crash by doing a definitions query on var err error; err.Error(). Will we ever learn?

(The if obj.Parent() == types.Universe { check doesn't work as intended for methods, as their parent is nil.)

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Nov 12, 2023
@seankhliao seankhliao changed the title gopls: crash in 'definitions' on error.Error method x/tools/gopls: crash in 'definitions' on error.Error method Nov 12, 2023
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Nov 12, 2023
@gopherbot gopherbot added this to the Unreleased milestone Nov 12, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.15.0 Nov 13, 2023
@adonovan adonovan self-assigned this Nov 16, 2023
@gopherbot
Copy link

Change https://go.dev/cl/543136 mentions this issue: gopls/internal/lsp/source: fix panic in definition(error.Error)

@adonovan adonovan changed the title x/tools/gopls: crash in 'definitions' on error.Error method x/tools/gopls: Definitions bug "internal error: no position for %v" on error.Error method Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants