bcicen/ctop · error

panic(err)

Error message

panic(err)

What it means

Panics when ui.Init() fails during terminal-UI startup in main. tcell's Init returns an error when the program cannot open/put the terminal into raw mode — e.g. stdout is not a TTY, TERM is unset or unsupported, or the terminfo database is missing. The program cannot run without a terminal, so startup aborts immediately.

Source

Thrown at main.go:94

// init ui
if *invertFlag {
	InvertColorMap()
}
ui.ColorMap = ColorMap // override default colormap
if err := ui.Init(); err != nil {
	panic(err)
}
tm.SetInputMode(tm.InputAlt)

defer Shutdown()

View on GitHub (pinned to 59f00dd6aa)

Solutions

  1. Run the tool inside a real terminal (TTY); it cannot run with redirected/pipe stdout
  2. Set a supported TERM value (e.g. xterm-256color) and ensure terminfo files are installed
  3. Replace the panic with a friendly message via fmt.Fprintln(os.Stderr,...)+os.Exit(1)
  4. Check terminal permissions/SSH PTY allocation if initialization still fails
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at main.go:94 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bcicen/ctop@59f00dd6aa (2026-09-02). Data as JSON: /api/errors/faf68c95d4a4ad79. Report an issue: GitHub.