jesseduffield/lazygit · error

Todo %s not found in git-rebase-todo

Error message

Todo %s not found in git-rebase-todo

What it means

An internal 'Should never happen' error from deleteTodos in pkg/utils/rebase_todo.go: while deleting todos (dropped commits) from .git-rebase-todo, a commit passed by the caller was not found in the parsed todo list. It means lazygit's in-memory commit model has diverged from the on-disk todo file between reading it and mutating it.

Source

Thrown at pkg/utils/rebase_todo.go:137

func DeleteTodos(fileName string, todosToDelete []Todo, commentChar byte) ([]byte, error) {
	todos, err := ReadRebaseTodoFile(fileName, commentChar)
	if err != nil {
		return nil, err
	}
	rearrangedTodos, err := deleteTodos(todos, todosToDelete)
	if err != nil {
		return nil, err
	}
	return todosToString(rearrangedTodos, commentChar)
}

func deleteTodos(todos []todo.Todo, todosToDelete []Todo) ([]todo.Todo, error) {
	for _, todoToDelete := range todosToDelete {
		idx, ok := findTodo(todos, todoToDelete)

		if !ok {
			// Should never happen
			return []todo.Todo{}, fmt.Errorf("Todo %s not found in git-rebase-todo", todoToDelete.Hash)
		}

		todos = Remove(todos, idx)
	}

	return todos, nil
}

func MoveTodosDown(fileName string, todosToMove []Todo, isInRebase bool, commentChar byte) error {
	return MoveTodos(fileName, todosToMove, isInRebase, 1, commentChar)
}

func MoveTodosUp(fileName string, todosToMove []Todo, isInRebase bool, commentChar byte) error {
	return MoveTodos(fileName, todosToMove, isInRebase, -1, commentChar)
}

func MoveTodos(fileName string, todosToMove []Todo, isInRebase bool, offset int, commentChar byte) error {
	todos, err := ReadRebaseTodoFile(fileName, commentChar)

View on GitHub (pinned to c477a2959b)

Solutions

  1. Abort and restart the interactive rebase to rebuild a consistent todo file
  2. Avoid editing .git-rebase-todo externally while lazygit is open on the same rebase
  3. If reproducible, capture the todo file and report the issue to the lazygit repo with the reproduction steps
Defensive patterns

Strategy: validation

Try / catch

Surface the error to the user with guidance to restart/abort the rebase; treat it as unrecoverable model divergence rather than retrying the delete.

Prevention

When it happens

Trigger: Dropping commits mid interactive rebase after the todo file changed underneath lazygit (another git process, manual edit of .git-rebase-todo, or a stale model after a conflict resolution). findTodo fails to match todoToDelete's hash among the file's todos.

Common situations: Running another git tool (editor, terminal git) against the same rebase while lazygit holds a stale view; racing the todo file after 'continue' operations; extremely rare hash-matching edge cases (abbreviated vs full hashes).

Related errors


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