{"record":{"id":"e985ab4e2f456910","repo":"gitbutlerapp/gitbutler","slug":"could-not-update-all-pr-targets-before-native-stack","errorCode":null,"errorMessage":"Could not update all PR targets before native stack registration:\n{}","messagePattern":"Could not update all PR targets before native stack registration:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-forge/src/review.rs","lineNumber":3135,"sourceCode":"            continue;\n        }\n        let params = but_github::UpdatePullRequestParams {\n            owner,\n            repo,\n            pr_number: review.number,\n            title: None,\n            body: None,\n            base: Some(target_branch),\n            state: None,\n        };\n        if let Err(err) = but_github::pr::update(preferred_account, params, storage).await {\n            target_errors.push(format!(\"PR #{} target: {err}\", review.number));\n        }\n    }\n    if !target_errors.is_empty() {\n        // Dissolved membership stays dissolved here; the next successful synchronization sees\n        // no registered stacks and recreates the desired one.\n        anyhow::bail!(\n            \"Could not update all PR targets before native stack registration:\\n{}\",\n            target_errors.join(\"\\n\")\n        );\n    }\n\n    but_github::stacks::finish(preferred_account, owner, repo, &prepared.plan, storage).await?;\n\n    // GitHub now renders the native stack, so GitButler's description footer is redundant.\n    // Strip any existing footers regardless of the configured description mode, which only\n    // applies to footer-based stacking. User text is preserved, and reviews whose body would\n    // not change are skipped entirely — unless the caller supplied a new description to push.\n    for (review, current_body) in reviews.iter().zip(bodies) {\n        let Some(current_body) = current_body else {\n            continue;\n        };\n        let updated_body = update_body_with_mode(\n            current_body.as_deref(),\n            review.number,","sourceCodeStart":3117,"sourceCodeEnd":3153,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-forge/src/review.rs#L3117-L3153","documentation":"Before registering a stack natively on GitHub, the review flow updates each PR's target branch. If any of those per-PR target updates fail, the errors are collected and this bail fires listing them all, aborting before but_github::stacks::finish runs.","triggerScenarios":"Preparing native stack registration for a multi-PR stack where one or more PR base/target updates fail (API error, permission denied, PR closed, rate limit), collecting 'PR #N target: <err>' entries.","commonSituations":"Branch protection or missing write access preventing target changes; PRs force-closed by a teammate mid-operation; GitHub API 5xx or rate limiting during batch updates.","solutions":["Inspect each 'PR #N target:' line to see which PRs and why they failed","Fix the underlying cause (permissions, closed PR, API availability) and retry the push/sync","Dissolved membership is expected here; the next successful synchronization recreates the stack, so simply retrying after fixing is safe"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Could not update all PR targets\") => {\n        eprintln!(\"fix target-update causes and retry; membership will be recreated on next sync\");\n    }\n    other => other?,\n}","preventionTips":["Verify write access to every PR in the stack before starting registration","Check all PRs are open before initiating the operation","Retry after transient API failures — the next successful sync recreates the stack"],"tags":["github","api","pull-request","stack","precondition"],"backgroundTag":"api-error-response","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}