Skip to content

panic: runtime error: invalid memory address or nil pointer dereference #3735

Open
@smeadows-source

Description

@smeadows-source

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    go version go1.23.7 darwin/arm64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    golang.org/x/tools/[email protected] h1:s4mznBqCHVHeuTYjxGYJhsW3Wp4FYon8YAqiJlwlpTY=
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    Version: 1.98.2 (Universal)
    Commit: ddc367ed5c8936efe395cffeec279b04ffd7db78
    Date: 2025-03-12T13:32:45.399Z
    Electron: 34.2.0
    ElectronBuildId: 11161602
    Chromium: 132.0.6834.196
    Node.js: 20.18.2
    V8: 13.2.152.36-electron.0
    OS: Darwin arm64 24.3.0
  • Check your installed extensions to get the version of the VS Code Go extension
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

    Tools Configuration

Environment

GOBIN: undefined
toolsGopath:
gopath: /Users/vn58kl9/go
GOROOT: /usr/local/go
PATH: /Users/vn58kl9/.rd/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/sbin:/usr/local/go/bin:/usr/local/munki:/Users/vn58kl9/Library/Application Support/JetBrains/Toolbox/scripts:opt/homebrew/Cellar/unixodbc/2.3.12/lib:opt/homebrew/Cellar/unixodbc/2.3.12/include:/Users/vn58kl9/Library/Python/3.9/bin:/opt/homebrew/Cellar/bash/5.2.37

Tools

go:	/usr/local/go/bin/go: go version go1.23.7 darwin/arm64

gopls:	/Users/vn58kl9/go/bin/gopls	(version: v0.12.2 built with go: go1.23.7)
gotests:	not installed
gomodifytags:	not installed
impl:	not installed
goplay:	not installed
dlv:	not installed
golangci-lint:	/Users/vn58kl9/go/bin/golangci-lint	(version: v1.55.2 built with go: go1.23.7)

Go env

Workspace Folder (processImzSOFax): /Users/vn58kl9/Documents/GitHub/processImzSOFax

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/vn58kl9/Library/Caches/go-build'
GOENV='/Users/vn58kl9/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/vn58kl9/go/pkg/mod'
GONOPROXY='gecgithub01.walmart.com'
GONOSUMDB='gecgithub01.walmart.com'
GOOS='darwin'
GOPATH='/Users/vn58kl9/go'
GOPRIVATE='gecgithub01.walmart.com'
GOPROXY='go.ci.artifacts.walmart.com/artifactory/golang-go-release-remote,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org go.ci.artifacts.walmart.com/artifactory/sumdb-go-release-remote/'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.7'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/vn58kl9/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/vn58kl9/Documents/GitHub/processImzSOFax/go.mod'
GOWORK=''
CGO_CFLAGS='-I/opt/homebrew/Cellar/unixodbc/2.3.12/include'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-L/opt/homebrew/Cellar/unixodbc/2.3.12/lib'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/xd/x6qdsqld56s6dgh857dsc0gc0000gp/T/go-build330518464=/tmp/go-build -gno-record-gcc-switches -fno-common'

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

Describe the bug

A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.

Steps to reproduce the behavior:

  1. START VSCODE
  2. See error

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.
[Info - 3:21:43 PM] 2025/03/27 15:21:42 go info for /Users/vn58kl9/Documents/GitHub/processImzSOFax
(go dir /Users/vn58kl9/Documents/GitHub/processImzSOFax)
(go version go version go1.23.7 darwin/arm64)
(valid build configuration = true)
(build flags: [])
(selected go env: [GO111MODULE=, GOCACHE=/Users/vn58kl9/Library/Caches/go-build, GOFLAGS=, GOMODCACHE=/Users/vn58kl9/go/pkg/mod, GOPATH=/Users/vn58kl9/go, GOPRIVATE=gecgithub01.walmart.com, GOROOT=/usr/local/go, GOWORK=])

[Info - 3:21:43 PM] 2025/03/27 15:21:43 go/packages.Load #1
snapshot=0
directory=file:///Users/vn58kl9/Documents/GitHub/processImzSOFax
query=[/Users/vn58kl9/Documents/GitHub/processImzSOFax/... builtin]
packages=12

[Info - 3:21:43 PM] 2025/03/27 15:21:43 go/packages.Load #1: updating metadata for 188 packages

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1050305c8]

goroutine 1211 [running]:
golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0x140003e2790, 0xd}, {0x140003e2790, 0xd}, {0x140003e2768, 0x4}, {0x14001803710, 0x3, 0x3}, {0x14001803740, ...}, ...})
/Users/vn58kl9/go/pkg/mod/golang.org/x/tools/[email protected]/internal/lsp/cache/check.go:1247 +0x748
golang.org/x/tools/gopls/internal/lsp/cache.(*packageHandleBuilder).buildPackageHandle(0x14001034660, {0x105590d00, 0x1400011bb30}, {0x140003e2790?, 0xd?}, 0x1400069bb00)
/Users/vn58kl9/go/pkg/mod/golang.org/x/tools/[email protected]/internal/lsp/cache/check.go:929 +0x2d8
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).getPackageHandles.func2()
/Users/vn58kl9/go/pkg/mod/golang.org/x/tools/[email protected]/internal/lsp/cache/check.go:808 +0x138
golang.org/x/sync/errgroup.(*Group).Go.func1()
/Users/vn58kl9/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x54
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1208
/Users/vn58kl9/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:72 +0x98
[Info - 3:21:43 PM]
true
[Info - 3:21:43 PM] 2025/03/27 15:21:43 go info for /Users/vn58kl9/Documents/GitHub/processImzSOFax
(go dir /Users/vn58kl9/Documents/GitHub/processImzSOFax)
(go version go version go1.23.7 darwin/arm64)
(valid build configuration = true)
(build flags: [])
(selected go env: [GO111MODULE=, GOCACHE=/Users/vn58kl9/Library/Caches/go-build, GOFLAGS=, GOMODCACHE=/Users/vn58kl9/go/pkg/mod, GOPATH=/Users/vn58kl9/go, GOPRIVATE=gecgithub01.walmart.com, GOROOT=/usr/local/go, GOWORK=])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions