Repository: derailed/k9s

Issue #3262: Crash when no `shellPod` is defined in config file
Created: 2025-04-09T14:46:30Z
Describe the bug
My configuration file only has a few things that I want to override, and I want to leave the rest as default. It looks like this:
k9s:
  liveViewAutoRefresh: true
  refreshRate: 1
  ui:
    enableMouse: true
    headless: true
    logoless: true
  skipLatestRevCheck: true
When I run k9s v0.50.0 with this config file, it crashes during startup. k9s v0.40.10 works fine.
If I add
  shellPod:
    image: busybox:1.35.0
it starts working again.
To Reproduce
Use this as your config file:
k9s:
  liveViewAutoRefresh: true
  refreshRate: 1
  ui:
    enableMouse: true
    headless: true
    logoless: true
  skipLatestRevCheck: true
Start k9s v0.50.0.
Historical Documents
Config
k9s:
  liveViewAutoRefresh: true
  refreshRate: 1
  ui:
    enableMouse: true
    headless: true
    logoless: true
  skipLatestRevCheck: true
Logs
10:44AM INF 🐶 K9s starting up...
10:44AM ERR Boom!! k9s init failed error="runtime error: invalid memory address or nil pointer dereference"
10:44AM ERR  stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:26 +0x5e\ngithub.com/derailed/k9s/cmd.run.func2()\n\tgithub.com/derailed/k9s/cmd/root.go:98 +0xab\npanic({0x5af5a40?, 0x9710d10?})\n\truntime/panic.go:792 +0x132\ngithub.com/derailed/k9s/internal/config.(*ShellPod).Validate(...)\n\tgithub.com/derailed/k9s/internal/config/shell_pod.go:39\ngithub.com/derailed/k9s/internal/config.(*K9s).Validate(0xc000245600, {0x6f748e8, 0xc000ab8fc0}, {0xc0011fbfb0, 0x9}, {0xc0011d34a0, 0x2e})\n\tgithub.com/derailed/k9s/internal/config/k9s.go:389 +0x14b\ngithub.com/derailed/k9s/internal/config.(*K9s).ActivateContext(0xc000245600, {0xc0011fbfb0, 0x9})\n\tgithub.com/derailed/k9s/internal/config/k9s.go:256 +0x245\ngithub.com/derailed/k9s/internal/config.(*Config).Refine(0xc000c52ea0, 0xc000a6efc0, 0xc000780540, 0xc000c52d00?)\n\tgithub.com/derailed/k9s/internal/config/config.go:96 +0x1d1\ngithub.com/derailed/k9s/cmd.loadConfiguration()\n\tgithub.com/derailed/k9s/cmd/root.go:145 +0x26a\ngithub.com/derailed/k9s/cmd.run(0xc00011fd00?, {0x62b604f?, 0x4?, 0x62b5ed3?})\n\tgithub.com/derailed/k9s/cmd/root.go:110 +0x305\ngithub.com/spf13/cobra.(*Command).execute(0x9781e80, {0xc0000720b0, 0x0, 0x0})\n\tgithub.com/spf13/cobra@v1.9.1/command.go:1015 +0xa94\ngithub.com/spf13/cobra.(*Command).ExecuteC(0x9781e80)\n\tgithub.com/spf13/cobra@v1.9.1/command.go:1148 +0x40c\ngithub.com/spf13/cobra.(*Command).Execute(...)\n\tgithub.com/spf13/cobra@v1.9.1/command.go:1071\ngithub.com/derailed/k9s/cmd.Execute()\n\tgithub.com/derailed/k9s/cmd/root.go:71 +0x1a\nmain.main()\n\tgithub.com/derailed/k9s/main.go:32 +0xf\n"

Stack trace
goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x5e
github.com/derailed/k9s/cmd.run.func2()
	github.com/derailed/k9s/cmd/root.go:98 +0xab
panic({0x5af5a40?, 0x9710d10?})
	runtime/panic.go:792 +0x132
github.com/derailed/k9s/internal/config.(*ShellPod).Validate(...)
	github.com/derailed/k9s/internal/config/shell_pod.go:39
github.com/derailed/k9s/internal/config.(*K9s).Validate(0xc000245600, {0x6f748e8, 0xc000ab8fc0}, {0xc0011fbfb0, 0x9}, {0xc0011d34a0, 0x2e})
	github.com/derailed/k9s/internal/config/k9s.go:389 +0x14b
github.com/derailed/k9s/internal/config.(*K9s).ActivateContext(0xc000245600, {0xc0011fbfb0, 0x9})
	github.com/derailed/k9s/internal/config/k9s.go:256 +0x245
github.com/derailed/k9s/internal/config.(*Config).Refine(0xc000c52ea0, 0xc000a6efc0, 0xc000780540, 0xc000c52d00?)
	github.com/derailed/k9s/internal/config/config.go:96 +0x1d1
github.com/derailed/k9s/cmd.loadConfiguration()
	github.com/derailed/k9s/cmd/root.go:145 +0x26a
github.com/derailed/k9s/cmd.run(0xc00011fd00?, {0x62b604f?, 0x4?, 0x62b5ed3?})
	github.com/derailed/k9s/cmd/root.go:110 +0x305
github.com/spf13/cobra.(*Command).execute(0x9781e80, {0xc0000720b0, 0x0, 0x0})
	github.com/spf13/cobra@v1.9.1/command.go:1015 +0xa94
github.com/spf13/cobra.(*Command).ExecuteC(0x9781e80)
	github.com/spf13/cobra@v1.9.1/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.9.1/command.go:1071
github.com/derailed/k9s/cmd.Execute()
	github.com/derailed/k9s/cmd/root.go:71 +0x1a
main.main()
	github.com/derailed/k9s/main.go:32 +0xf

Expected behavior
k9s would handle a partial config file, as it did in previous versions.
Versions (please complete the following information):

OS: Fedora 41
K9s: 0.50.0
K8s: v1.31.6-gke.1020000

Duplicate issue #3258: mac silicon `0.50.0` runtime error
Created: 2025-04-09T10:19:40Z
Hello, getting the following error after upgrading k9s to 0.50.0 on OSX silicon:
runtime error: invalid memory address or nil pointer dereference

Simply after running k9s, leading to the tool being unusable (this happens at boot of k9s). It appears I cannot downgrade to a previous working version with homebrew either, so it's a bummer.
To Reproduce
brew upgrade k9s
Versions:

OS: OSX Silicon
K9s: 0.50.0
k8s: 1.31 (eks)

Closing comment (2025-04-10T05:40:37Z): Thank you all for pipling in! I think this might be a dup of #3262?