runtime error: invalid memory address or nil pointer dereference
Describe the bug ~ [ gh dash ] 4:00 PM Caught panic:
runtime error: invalid memory address or nil pointer dereference
Restoring terminal...
goroutine 1 [running]: runtime/debug.Stack() /opt/hostedtoolcache/go/1.22.6/x64/src/runtime/debug/stack.go:24 +0x5e runtime/debug.PrintStack() /opt/hostedtoolcache/go/1.22.6/x64/src/runtime/debug/stack.go:16 +0x13 github.com/charmbracelet/bubbletea.(*Program).Run.func1() /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:478 +0x91 panic({0xbcd320?, 0x1669800?}) /opt/hostedtoolcache/go/1.22.6/x64/src/runtime/panic.go:770 +0x132 github.com/dlvhdr/gh-dash/v4/ui/components/prssection.(*Model).watchChecks(0xc000c6a000) /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/components/prssection/watchChecks.go:21 +0x10b github.com/dlvhdr/gh-dash/v4/ui/components/prssection.Model.Update({{0x0, {{0xc6ecd7, 0x3}, {0xc89586, 0xe}, 0x0, 0x0}, 0xc000c2ae40, {{{...}, 0x5f5e100}, ...}, ...}, ...}, ...) /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/components/prssection/prssection.go:124 +0x15a6 github.com/dlvhdr/gh-dash/v4/ui.(*Model).updateSection(0xc000c22000, 0x0, {0xc6e782?, 0xc0000de2d0?}, {0xc1aa40?, 0xc000a80030?}) /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/ui.go:607 +0x84 github.com/dlvhdr/gh-dash/v4/ui.(*Model).updateCurrentSection(0xc000c22000, {0xc1aa40, 0xc000a80030}) /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/ui.go:626 +0x105 github.com/dlvhdr/gh-dash/v4/ui.Model.Update({0x169d5a0, {0x1, {0x0, 0x0}, {0x2d, 0x2e, {{...}, {...}, {...}, {...}, ...}, ...}, ...}, ...}, ...) /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/ui.go:506 +0x2227 github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0003f9380, {0x118fe30?, 0xc000666000?}, 0xc00002e4e0) /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411 +0x5e2 github.com/charmbracelet/bubbletea.(*Program).Run(0xc0003f9380) /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543 +0x86b github.com/dlvhdr/gh-dash/v4/cmd.init.0.func1(0xc0001c7200?, {0x1705b00, 0x0, 0xc6fadd?}) /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:142 +0x2ca github.com/spf13/cobra.(*Command).execute(0x167b8a0, {0xc000022090, 0x0, 0x0}) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xab1 github.com/spf13/cobra.(*Command).ExecuteC(0x167b8a0) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff github.com/spf13/cobra.(*Command).Execute(...) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039 github.com/dlvhdr/gh-dash/v4/cmd.Execute() /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:44 +0x1a main.main() /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/gh-dash.go:8 +0xf
To Reproduce Steps to reproduce the behavior:
- Start app
- typw
w - See error
Expected behavior a search
Desktop (please complete the following information):
- OS: Arch Linux
I get the same error when I try to run gh dash on latest version Running on fedora gnome
$ gh dash
Caught panic:
runtime error: invalid memory address or nil pointer dereference
Restoring terminal...
goroutine 1 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/debug/stack.go:18 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:519 +0x8b
panic({0xc0a040?, 0x1597c00?})
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/panic.go:785 +0x132
github.com/dlvhdr/gh-dash/v4/ui/theme.ParseTheme(_)
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/theme/theme.go:42 +0x40
github.com/dlvhdr/gh-dash/v4/ui.Model.Update({0x15cc960, {0x0, {0x1094d50, 0x0}, {0x0, 0x3c, {{...}, {...}, {...}, {...}, ...}, ...}, ...}, ...}, ...)
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/ui.go:483 +0x4611
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0003ff560, {0x109c5b8?, 0xc0005c2000?}, 0xc0000a8850)
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:452 +0x810
github.com/charmbracelet/bubbletea.(*Program).Run(0xc0003ff560)
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:593 +0xa32
github.com/dlvhdr/gh-dash/v4/cmd.init.0.func1(0x15aa240?, {0x15f51a0, 0x0, 0x0?})
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:146 +0x2c5
github.com/spf13/cobra.(*Command).execute(0x15aa240, {0xc000022090, 0x0, 0x0})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0x15aa240)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/dlvhdr/gh-dash/v4/cmd.Execute()
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:44 +0x1a
main.main()
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/gh-dash.go:8 +0xf
$ gh dash --version
gh-dash version dev
goos: linux
goarch: amd64
module version: v4.7.0, checksum: h1:FJPndabSwUigGrgNv7AtqcyKRHCm/vJe70ShKuk590c=
Hi @carmen-gh, can you provide repro steps?
I can't reproduce with the original ones by @reinhardt-bit.
Pressing w should watch a PR and that works.
I installed gh-dash and tried to launch and I get immediately the error. I can't even start the program.
gh dash
this is my go version
go version go1.22.4 linux/amd64
it seems one of the newer versions is not compatible anymore with my config. After removing my config it works again.
Can replicate this issue with a fresh install and no configuration file (unless a default one ships with the application). Running Debian 12
Ran
gh extension dlvhdr/gh-dash
gh dash
Go version: 1.22.5 linux/amd64 gh-dash version (assuming it matches the repo at this current time) v4.7.0
MacOS
Caught panic:
runtime error: invalid memory address or nil pointer dereference
Restoring terminal...
goroutine 1 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/debug/stack.go:18 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:519 +0x8b
panic({0x5eb3100?, 0x6453f40?})
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/panic.go:785 +0x132
github.com/dlvhdr/gh-dash/v4/ui.Model.Update({0x64882c0, {0x0, {0x5e141e8, 0x0}, {0x0, 0x0, {{...}, {...}, {...}, {...}, ...}, ...}, ...}, ...}, ...)
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/ui.go:549 +0x4909
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc000451560, {0x5f66d38?, 0xc00063c000?}, 0xc000030a10)
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:452 +0x810
github.com/charmbracelet/bubbletea.(*Program).Run(0xc000451560)
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:593 +0xa32
github.com/dlvhdr/gh-dash/v4/cmd.init.0.func1(0x6466120?, {0x64b0b80, 0x0, 0x0?})
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:146 +0x2c5
github.com/spf13/cobra.(*Command).execute(0x6466120, {0xc000190010, 0x0, 0x0})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0x6466120)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/dlvhdr/gh-dash/v4/cmd.Execute()
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:44 +0x1a
main.main()
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/gh-dash.go:8 +0xf
Trying to guess what @carmen-gh did, I deleted my .config/gh and .config/gh-dash directories.
I still get the same issue.
$ gh-dash --version
gh-dash version 4.7.0
goos: darwin
goarch: amd64
I get the same issue on debian oldstable:
gh dash
Caught panic:
runtime error: invalid memory address or nil pointer dereference
Restoring terminal...
goroutine 1 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/debug/stack.go:18 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:519 +0x8b
panic({0xc0a040?, 0x1597c00?})
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/panic.go:785 +0x132
github.com/dlvhdr/gh-dash/v4/ui.Model.Update({0x15cc960, {0x0, {0x1094d50, 0x0}, {0x0, 0x61, {{...}, {...}, {...}, {...}, ...}, ...}, ...}, ...}, ...)
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/ui/ui.go:549 +0x4909
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc000165200, {0x109c5b8?, 0xc0005d6000?}, 0xc000118850)
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:452 +0x810
github.com/charmbracelet/bubbletea.(*Program).Run(0xc000165200)
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:593 +0xa32
github.com/dlvhdr/gh-dash/v4/cmd.init.0.func1(0x15aa240?, {0x15f51a0, 0x0, 0x0?})
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:146 +0x2c5
github.com/spf13/cobra.(*Command).execute(0x15aa240, {0xc000126040, 0x0, 0x0})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0x15aa240)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/dlvhdr/gh-dash/v4/cmd.Execute()
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/cmd/root.go:44 +0x1a
main.main()
/home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/[email protected]/gh-dash.go:8 +0xf
% gh dash --version
gh-dash version dev
goos: linux
goarch: amd64
module version: v4.7.0, checksum: h1:FJPndabSwUigGrgNv7AtqcyKRHCm/vJe70ShKuk590c=
lsb_release -d
Description: Debian GNU/Linux 11 (bullseye)
go version
go version go1.23.1 linux/amd64
The breakage I am seeing is in v4.6.0. That version crashes in the same manner for me. v4.5.4 does not exhibit this crash.
@gotcha and I both crash here https://github.com/dlvhdr/gh-dash/blob/v4.7.0/ui/ui.go#L548-L549
Added in the first tagged release that crashes me: https://github.com/dlvhdr/gh-dash/compare/v4.5.4...v4.6.0#diff-85b955154c0fd9a0bf7077ba557502ee99699bf50163cf2ac82a1a4821625caaR541-R542
I see loads of if currSection != nil { guards but not one here.
This solves it for me. Am new to go so am unsure about testing it. Will work up a PR:
index dfe4dc9..545c8ef 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -546,7 +546,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
case execProcessFinishedMsg, tea.FocusMsg:
- cmds = append(cmds, currSection.FetchNextPageSectionRows()...)
+ if currSection != nil {
+ cmds = append(cmds, currSection.FetchNextPageSectionRows()...)
+ }
case tea.WindowSizeMsg:
m.onWindowSizeChanged(msg)```
I am now convinced that the issue @gotcha and I are experiencing is distinct from OP's (@reinhardt-bit's) issue and am opening a new issue.