panic: runtime error: index out of range [0] in GetContainers (v0.24.2)

Author: B-AJ-AmarCreated Feb 13, 2026Updated Jul 31, 2026
Labelsbug

Describe the bug Lazydocker panics and crashes immediately upon startup with a runtime error: index out of range [0] with length 0. Before the crash, the terminal displays raw ANSI escape sequences (mouse tracking codes) because the TUI fails to initialize properly due to the panic occurring during the initial container refresh.

To Reproduce Steps to reproduce the behavior:

  1. Open Kitty terminal (or any terminal with xterm-kitty TERM).
  2. Run lazydocker.
  3. The app crashes immediately, dumping a stack trace.

Expected behaviour The application should load the dashboard and list containers without crashing, even if certain Docker objects (containers or networks) have unusual or empty attributes.

Screenshots (Attach the image you have showing the "Matrix" numbers and the broken UI layout)

Desktop (please complete the following information):

  • OS: Linux (amd64)
  • Lazydocker Version: v0.24.2
  • Terminal: xterm-kitty

Additional context The crash occurs specifically in the GetContainers function. It seems to be an edge case where an expected slice is empty.

Stack Trace:

panic: runtime error: index out of range [0] with length 0

goroutine 37 [running]:
github.com/jesseduffield/lazydocker/pkg/commands.(*DockerCommand).GetContainers(0xc0000df500, {0x0, 0x0, 0x0?})
	github.com/jesseduffield/lazydocker/pkg/commands/docker.go:259 +0x82f
github.com/jesseduffield/lazydocker/pkg/commands.(*DockerCommand).RefreshContainersAndServices(0xc0000df500, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0})
	github.com/jesseduffield/lazydocker/pkg/commands/docker.go:185 +0x125
github.com/jesseduffield/lazydocker/pkg/gui.(*Gui).refreshContainersAndServices(0xc00039a000)
	github.com/jesseduffield/lazydocker/pkg/gui/containers_panel.go:258 +0xd5
github.com/jesseduffield/lazydocker/pkg/gui.(*Gui).refresh.func2()
	github.com/jesseduffield/lazydocker/pkg/gui/gui.go:305 +0x1c
created by github.com/jesseduffield/lazydocker/pkg/gui.(*Gui).refresh in goroutine 55
	github.com/jesseduffield/lazydocker/pkg/gui/gui.go:304 +0x96

Source: jesseduffield/lazydocker