Skip to content

Panic: index out of range [0] with length 0 #2466

@mycrEEpy

Description

@mycrEEpy




Describe the bug
When trying to navigate through the tables sometimes k9s panics with an index out of range error.

To Reproduce

It's probably not at random, but I'm currently unable to find reproducible actions.

Historical Documents
Logs:

11:39AM ERR Boom! runtime error: index out of range [0] with length 0
11:39AM ERR goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x5e
github.com/derailed/k9s/cmd.run.func2()
	github.com/derailed/k9s/cmd/root.go:84 +0xa5
panic({0x4ab7340?, 0xc007f590f8?})
	runtime/panic.go:914 +0x21f
github.com/derailed/tview.(*Application).Run.func1()
	github.com/derailed/tview@v0.8.2/application.go:243 +0x45
panic({0x4ab7340?, 0xc007f590f8?})
	runtime/panic.go:914 +0x21f
github.com/derailed/tview.(*TextView).reindexBuffer(0xc000ca99e0, 0x9c)
	github.com/derailed/tview@v0.8.2/textview.go:901 +0xef0
github.com/derailed/tview.(*TextView).Draw(0xc000ca99e0, {0x58a3ad0?, 0xc0008d5200})
	github.com/derailed/tview@v0.8.2/textview.go:991 +0x173
github.com/derailed/tview.(*Flex).Draw(0xc000ddc240, {0x58a3ad0?, 0xc0008d5200})
	github.com/derailed/tview@v0.8.2/flex.go:211 +0x386
github.com/derailed/tview.(*Pages).Draw(0xc000b90360, {0x58a3ad0, 0xc0008d5200})
	github.com/derailed/tview@v0.8.2/pages.go:300 +0xce
github.com/derailed/tview.(*Application).draw(0xc0002387e0)
	github.com/derailed/tview@v0.8.2/application.go:597 +0x13a
github.com/derailed/tview.(*Application).Run(0xc0002387e0)
	github.com/derailed/tview@v0.8.2/application.go:343 +0x549
github.com/derailed/k9s/internal/view.(*App).Run(0xc0003a0480)
	github.com/derailed/k9s/internal/view/app.go:548 +0x8f
github.com/derailed/k9s/cmd.run(0xc000209a00?, {0x4cfd0bf?, 0x4?, 0x4cfcfd3?})
	github.com/derailed/k9s/cmd/root.go:102 +0x365
github.com/spf13/cobra.(*Command).execute(0x76adfe0, {0xc0001182e0, 0x2, 0x2})
	github.com/spf13/cobra@v1.8.0/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0x76adfe0)
	github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/derailed/k9s/cmd.Execute(...)
	github.com/derailed/k9s/cmd/root.go:59
main.main()
	github.com/derailed/k9s/main.go:32 +0x1b

Expected behavior

Navigating through tables should not panic the application.

Versions (please complete the following information):

  • OS: Ubuntu 22.04
  • K9s: 0.31.2
  • K8s: 1.28.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions