Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

av st sync exits with "error: reference not found" #429

Open
oleg-codaio opened this issue Oct 14, 2024 · 0 comments
Open

av st sync exits with "error: reference not found" #429

oleg-codaio opened this issue Oct 14, 2024 · 0 comments

Comments

@oleg-codaio
Copy link
Contributor

Hi, somehow I managed to get my local environment in a bad state (perhaps not always using av) and now I get the following error when syncing:

➜ git:(main) av st sync --all        
                                                                                                                 
  ✓ GitHub fetch is done                                                                                         
  ✓ Restack is done                                                                                              
                                                                                                                 
    * branch1                                        
    │                                                                                                            
    │ * branch2
    │ │                                                                                                          
    │ │ * etc...
                                                                                                                 
  ✓ GitHub fetch is done                                                                                         
  ✓ Restack is done                                                                                              
                                                                                                                 
    * branch1
    │                                                                                                            
    │ * branch2
    │ │                                                                                                          
    │ │ * etc...
    ├─┴─┴─┴─┴─┴─┴─┴─┘                                                                                            
    * main d9d1c26                                                                                               
                                                                                                                 
  ⣻ Finding the changed branches...                                                                              
                                                                                                                 
error: reference not found
exit status 1

Debugging this was difficult because the Bubble Tea framework seems to clear helpful messages (I had to put opts := []tea.ProgramOption{tea.WithoutRenderer()} into tea.go), but it turns out the error is here:

av/internal/gh/ghui/push.go

Lines 436 to 439 in 8758782

localRef, err := repo.Reference(br, true)
if err != nil {
return err
}

At a later step, I got another error here:

ref, err := vm.repo.GoGitRepo().Reference(plumbing.ReferenceName(br), true)
if err != nil {
return err
}

Unfortunately I don't have a clear repro, but still wanted to file this. Is it possible to recover more gracefully from this error and still handle the other branches? Locally I could address this by appending the error to noPushBranches / noDeleteBranches or just by orphaning those branches but perhaps the UX should prompt to orphan the branch if this happens instead of crashing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant