jesseduffield/lazygit · info

YOU DIED!

Error message

YOU DIED!

What it means

Returned by SnakeHelper.renderSnakeGame via OnUIThread when the built-in snake game's render callback reports alive=false, i.e. the snake collided and the run ended. Tr.YouDied ('YOU DIED!') is displayed through lazygit's normal error-alert path — the game intentionally reuses the error channel as a UI notification, so this is not a defect but a deliberately theatrical game-over toast.

Source

Thrown at pkg/gui/controllers/helpers/snake_helper.go:43

	game := snake.NewGame(view.InnerWidth(), view.InnerHeight(), self.renderSnakeGame, self.c.LogAction)
	self.game = game
	game.Start()
}

func (self *SnakeHelper) ExitGame() {
	self.game.Exit()
}

func (self *SnakeHelper) SetDirection(direction snake.Direction) {
	self.game.SetDirection(direction)
}

func (self *SnakeHelper) renderSnakeGame(cells [][]snake.CellType, alive bool) {
	view := self.c.Views().Snake

	if !alive {
		self.c.OnUIThread(func() error { return errors.New(self.c.Tr.YouDied) })
		return
	}

	output := self.drawSnakeGame(cells)

	view.Clear()
	fmt.Fprint(view, output)
	self.c.Render()
}

func (self *SnakeHelper) drawSnakeGame(cells [][]snake.CellType) string {
	writer := &strings.Builder{}

	for i, row := range cells {
		for _, cell := range row {
			switch cell {
			case snake.None:
				writer.WriteString(" ")

View on GitHub (pinned to c477a2959b)

Solutions

  1. Acknowledge the alert and press the game's restart key (r) for a new run.
  2. Exit the game (q/Esc) to return to the normal UI.
  3. No git or repository action is needed.
Defensive patterns

Strategy: try-catch

Try / catch

// nothing to catch: the error IS the game-over notification
if err := <-gameErrCh; err != nil && err.Error() == c.Tr.YouDied {
    // restart or exit the game
}

Prevention

When it happens

Trigger: Playing the hidden snake game (pressing the key sequence to open it, default '?e' era cheat) and steering the snake into a wall or its own body; also when a tick renders after a losing move.

Common situations: Only ever inside the easter-egg game; no git state is touched. Users seeing it outside the game would have a view-misrouting bug, which does not occur in practice.


AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15). Data as JSON: /api/errors/03de5a55634ed286. Report an issue: GitHub.