gitbutlerapp/gitbutler · error

Bitbucket does not support reopening a declined pull…

Error message

Bitbucket does not support reopening a declined pull request via the API.

What it means

Bitbucket's REST API has no endpoint to reopen a pull request that has been declined; GitButler therefore rejects the operation up front instead of sending a doomed request. This is a deliberate guard in `update_review`'s Bitbucket arm when the requested state transition is to `Open`.

Solutions

  1. Create a new pull request instead of reopening the declined one.
  2. Guard the caller: only request `ReviewState::Open` for forges that support reopening (GitHub/GitLab).
  3. On Bitbucket, if the PR was declined by mistake, ask a reviewer with permission via the Bitbucket web UI — but note the API itself cannot do it.
  4. Skip the state change and update only title/body/target if those are what you needed.

Example fix

// before
update_review(..., ForgeName::Bitbucket, Some(ReviewState::Open), ...).await?;

// after
if forge == ForgeName::Bitbucket && state == Some(ReviewState::Open) {
    // declined Bitbucket PRs cannot be reopened via API; open a new PR instead
    create_review(...).await?;
} else {
    update_review(..., forge, state, ...).await?;
}
Defensive patterns

Strategy: validation

Validate before calling

fn can_reopen(forge: ForgeName) -> bool { !matches!(forge, ForgeName::Bitbucket) }
if state == Some(ReviewState::Open) && !can_reopen(forge) {
    // create a new PR instead
}

Try / catch

match update_review(..., ForgeName::Bitbucket, Some(ReviewState::Open), ...) {
    Err(e) if e.to_string().contains("does not support reopening") => create_review(...).await?,
    other => other?,
}

Prevention

When it happens

Trigger: Calling `update_review` with `ForgeName::Bitbucket` and `state: Some(ReviewState::Open)` on a PR that was declined/closed.

Common situations: Trying to reuse a declined Bitbucket PR after new commits; migrating a GitHub workflow (where reopen works) to Bitbucket; scripted state synchronization that unconditionally sets Open.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/9a9ba2b6a5b8d215. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-forge/src/review.rs:2473

            // a `state` field. Map the forge-agnostic ReviewState onto that.
            let state_event = state.as_ref().map(|s| s.as_gitlab_state_event());
            let params = but_gitlab::UpdateMergeRequestParams {
                project_id,
                mr_iid,
                title: title.as_deref(),
                description: body.as_deref(),
                target_branch: target_base.as_deref(),
                state_event,
            };
            but_gitlab::mr::update(preferred_account, params, storage).await?;
            Ok(())
        }
        ForgeName::Bitbucket => {
            let preferred_account = preferred_forge_user
                .as_ref()
                .and_then(|user| user.bitbucket());
            if matches!(state, Some(ReviewState::Open)) {
                return Err(anyhow::anyhow!(
                    "Bitbucket does not support reopening a declined pull request via the API."
                ));
            }
            if title.is_some() || body.is_some() || target_base.is_some() {
                let id = review_number
                    .try_into()
                    .context("PR: Failed to cast usize to i64, somehow")?;
                let params = but_bitbucket::UpdatePullRequestParams {
                    workspace: owner,
                    repo_slug: repo,
                    id,
                    title: title.as_deref(),
                    description: body.as_deref(),
                    target_branch: target_base.as_deref(),
                };
                but_bitbucket::pr::update(preferred_account, params, storage).await?;
            }
            if matches!(state, Some(ReviewState::Closed)) {

View on GitHub (pinned to 58e5313667)