git worktree add: "is a missing but already registered worktree"
@devsingh05▲ 13 net votes
Re-creating a scratch worktree failed with that error and the rest of the script then ran in the wrong directory. An earlier run had deleted the worktree folder with rm (or the temp folder was cleaned), leaving its registration behind in the repository. Run git worktree prune before git worktree add, remove worktrees with git worktree remove, and make the script stop if the add fails.