govisual-studio-codedelve

invalid memory address or nil pointer dereference panic from delve package


Delve version: 1.23.1 Go version: go1.23.2 darwin/arm64 Cursor version: 0.42.4 (VSCode 1.93.1) OS: MacOS 14.6 Architecture: M1 arm64

When running the debugger in VS Code, I get the following panic coming from delve. It doesn't matter where I try to debug from, but it consistently happens. It suddenly started happening while I was working. Ive uninstalled, reinstalled, and updated both Go and Delve, but the problem persists.

error layer=dap recovered panic: runtime error: invalid memory address or nil pointer dereference
goroutine 34 [running]:
runtime/debug.Stack()
        /opt/homebrew/Cellar/go/1.23.2/libexec/src/runtime/debug/stack.go:26 +0x64
github.com/go-delve/delve/service/dap.(*Session).recoverPanic(0x14000386000, {0x100bad4e0, 0x140026d97a0})
        /Users/me/go/pkg/mod/github.com/go-delve/delve@v1.23.1/service/dap/server.go:579 +0x44
panic({0x100afb980?, 0x100f55550?})
        /opt/homebrew/Cellar/go/1.23.2/libexec/src/runtime/panic.go:785 +0x124
github.com/go-delve/delve/pkg/proc.fakeFunctionEntryScope(0x14000b280f0?, 0x100bb88b0?, 0x14000083720, 0x14000083718)
        /Users/me/go/pkg/mod/github.com/go-delve/delve@v1.23.1/pkg/proc/fncall.go:979 +0x28
github.com/go-delve/delve/pkg/proc.funcCallStep(0x14000386500, 0x14002b190e0, {0x100bb88b0, 0x140026ec460})
        /Users/me/go/pkg/mod/github.com/go-delve/delve@v1.23.1/pkg/proc/fncall.go:851 +0x408
github.com/go-delve/delve/pkg/proc.(*evalStack).resume(0x14002b190e0, 0x14002b56300)
        /Users/me/go/pkg/mod/github.com/go-delve/delve@v1.23.1/pkg/proc/eval.go:925 +0x4b0
github.com/go-delve/delve/pkg/proc.callInjectionProtocol(0x14000b280f0, {0x140000cbd40?, 0x10097d150?, 0x0?})
        /Users/me/go/pkg/mod/github.com/go-delve/delve@v1.23.1/pkg/proc/fncall.go:1094 +0x478
github.com/go-delve/delve/pkg/proc.(*TargetGroup).Continue(0x14000124140)
        /Users/me/go/pkg/mod/github.com/go-delve/delve@v1.23.1/pkg/proc/target_exec.go:162 +0x870
github.com/go-delve/delve/pkg/proc.EvalExpressionWithCalls(0x14000124140, 0x14003f9c240, {0x1400337a870, 0x29}, {0x1, 0x1, 0x400, 0x40, 0xffffffffffffffff, 0x0}, ...)
        /Users/me/go/pkg/mod/github.com/go-delve/delve@v1.23.1/pkg/proc/fncall.go:190 +0x3d4

Solution

  • As Brits pointed out, removing my watch expressions fixed it. See https://github.com/go-delve/delve/issues/3700