@@ -211,10 +211,13 @@ func checkoutRemoteStack(cfg *config.Config, sf *stack.StackFile, gitDir string,
211211 localStack := findLocalStackForRemotePRs (sf , prs )
212212
213213 if localStack != nil {
214+ // Sync remote PR metadata before comparing composition so locally
215+ // tracked stacks with incomplete PR refs don't appear to conflict.
216+ syncRemotePRState (localStack , prs )
217+
214218 // Case A: branch is in a local stack — check composition
215219 if stackCompositionMatches (localStack , remoteStack .PullRequests ) {
216- // Composition matches — sync PR state and checkout
217- syncRemotePRState (localStack , prs )
220+ // Composition matches — checkout
218221 if localStack .ID == "" {
219222 localStack .ID = remoteStackID
220223 }
@@ -280,6 +283,9 @@ func fetchStackPRDetails(client github.ClientOps, prNumbers []int) ([]*github.Pu
280283 if err != nil {
281284 return nil , fmt .Errorf ("fetching PR #%d: %w" , n , err )
282285 }
286+ if pr == nil {
287+ return nil , fmt .Errorf ("PR #%d not found" , n )
288+ }
283289 prs = append (prs , pr )
284290 }
285291 return prs , nil
@@ -450,7 +456,8 @@ func importRemoteStack(
450456 if ! git .BranchExists (trunk ) {
451457 remoteTrunk := remote + "/" + trunk
452458 if err := git .CreateBranch (trunk , remoteTrunk ); err != nil {
453- cfg .Warningf ("could not pull trunk branch %s: %v" , trunk , err )
459+ cfg .Errorf ("could not create trunk branch %s from %s: %v" , trunk , remoteTrunk , err )
460+ return nil , ErrSilent
454461 }
455462 }
456463
0 commit comments