jesseduffield / jesseduffield/lazygit
Error when moving commit after merge
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
### Describe the bug
After pulling from remote, leading to a merge, I wanted to move one of the commits. I hit Ctrl+J and get this error message:
Or in text form (for better issue search):
> Destination position for moving todo is out of range
> error: there was a problem with the editor "'/opt/homebrew/bin/lazygit'"
I think the operation I attempted is invalid, so this bug report is not a request to make the operation work, but more to catch the error early and improve the error message.
### To Reproduce
1. I'm on a feature branch with some commits ahead and behind of master.
2. On GitHub there's a pull request from the feature branch to the main branch. A reviewer comments a suggestion, which I commit via GitHub web UI
3. Before pulling that remote change, I add a new commit on my local branch. Now I'm one ahead and one behind of the remote branch
4. I pull with `p`, which leads to a merge commit
5. I navigate to the remote commit from the reviewer and hit Ctrl+J
6. => The error message appears
### Expected behavior
I expect an error message like "This operation is invalid, see xyz", with xyz maybe being a reference to further documentation of why the operation is invalid.
### Screenshots
See above
### Version info:
* `lazygit --version`: `commit=, build date=, build source=Homebrew, version=0.55.1, os=darwin, arch=arm64, git version=2.51.0`
* `git --version`: `git version 2.51.0`
### Additional context
The issue template for bugs mentions `lazygit --debug`, so I tried that to see if I can provide some useful logs, but it runs into a different error (directly upon launch, before interacting with the TUI) and exits:
```console
$ lazygit --debug
POTENTIAL DEADLOCK: Recursive locking:
current goroutine 0 lock 0x1400025e0ac
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:500 helpers.(*RefreshHelper).refreshBranches ??? <<<<<
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:499 helpers.(*RefreshHelper).refreshBranches ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:130 helpers.(*RefreshHelper).Refresh.func2.3 ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:106 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:722 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/task.go:22 gocui.(*TaskImpl).Done ???
Previous place where the lock was grabbed (same goroutine)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:318 helpers.(*RefreshHelper).refreshCommitsWithLimit ??? <<<<<
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:317 helpers.(*RefreshHelper).refreshCommitsWithLimit ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:273 helpers.(*RefreshHelper).refreshCommitsAndCommitFiles ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:106 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:722 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/task.go:22 gocui.(*TaskImpl).Done ???
Other goroutines holding locks:
goroutine 0 lock 0x1400025e094
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:508 helpers.(*RefreshHelper).refreshFilesAndSubmodules ??? <<<<<
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:507 helpers.(*RefreshHelper).refreshFilesAndSubmodules ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:153 helpers.(*RefreshHelper).Refresh.func2.8 ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:106 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:722 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/task.go:22 gocui.(*TaskImpl).Done ???
goroutine 0 lock 0x1400025e09c
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:453 helpers.(*RefreshHelper).refreshBranches ??? <<<<<
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:452 helpers.(*RefreshHelper).refreshBranches ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:130 helpers.(*RefreshHelper).Refresh.func2.3 ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:106 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:722 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/task.go:22 gocui.(*TaskImpl).Done ???
goroutine 0 lock 0x140003444f8
github.com/jesseduffield/lazygit/pkg/commands/git_commands/main_branches.go:42 git_commands.(*MainBranches).Get ??? <<<<<
github.com/jesseduffield/lazygit/pkg/commands/git_commands/main_branches.go:41 git_commands.(*MainBranches).Get ???
github.com/jesseduffield/lazygit/pkg/commands/git_commands/commit_loader.go:103 git_commands.(*CommitLoader).GetCommits ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:334 helpers.(*RefreshHelper).refreshCommitsWithLimit ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:273 helpers.(*RefreshHelper).refreshCommitsAndCommitFiles ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:106 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:722 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/task.go:22 gocui.(*TaskImpl).Done ???
```
Contributor guide
Assessment
This issue has not been assessed yet.