gitbutlerapp/gitbutler · warning

Review labels for forge

Error message

Review labels for forge {forge:?} are not implemented yet.

What it means

The add-labels-to-review function implements only GitHub; any other `ForgeName` reaches the wildcard `_` arm which returns this anyhow error. It is a deliberate 'not implemented yet' guard for that forge, not a network or auth problem.

Solutions

  1. Implement the `_` arm for the missing forge by delegating to that forge's add-label API, mirroring the GitHub branch.
  2. In the caller, check `forge == ForgeName::GitHub` before offering/invoking label addition and disable the feature for other forges.
  3. If the repo is really on GitHub, fix whatever caused the wrong ForgeName to reach this function.

Example fix

// before
add_review_labels(forge, review_number, labels, storage).await?;

// after
ensure!(forge == ForgeName::GitHub, "Adding review labels is only supported on GitHub");
add_review_labels(forge, review_number, labels, storage).await?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust: gate the mutation on forge support
fn supports_review_labels(forge: ForgeName) -> bool {
    matches!(forge, ForgeName::GitHub)
}

Try / catch

if let Err(e) = add_review_labels(forge, review_number, labels, storage).await {
    if e.to_string().contains("not implemented") {
        // show 'labels not supported on this forge' instead of a raw error
    } else {
        return Err(e);
    }
}

Prevention

When it happens

Trigger: Calling the add-review-labels function with `forge` other than `ForgeName::GitHub` — e.g. attempting to add a label to a GitLab merge request or Bitbucket pull request through this API.

Common situations: Users of GitLab/Bitbucket projects try to tag a review with labels in the UI; automation scripts call the label API without checking the forge type; a project's forge is misdetected so a GitHub repo takes the unimplemented path.

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/c9445bdff52de11a. Report an issue: GitHub.

Appendix: source

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

) -> Result<Vec<ForgeReviewLabel>> {
    let crate::forge::ForgeRepoInfo {
        forge, owner, repo, ..
    } = forge_repo_info;
    match forge {
        ForgeName::GitHub => {
            let preferred_account = preferred_forge_user.as_ref().and_then(|user| user.github());
            let labels = but_github::pr::add_labels(
                preferred_account,
                owner,
                repo,
                review_number,
                labels,
                storage,
            )
            .await?;
            Ok(labels.into_iter().map(Into::into).collect())
        }
        _ => Err(anyhow::anyhow!(
            "Review labels for forge {forge:?} are not implemented yet."
        )),
    }
}

/// Remove one label from a review.
pub async fn remove_review_label(
    preferred_forge_user: &Option<crate::ForgeUser>,
    forge_repo_info: &crate::forge::ForgeRepoInfo,
    review_number: usize,
    label: &str,
    storage: &but_forge_storage::Controller,
) -> Result<()> {
    let crate::forge::ForgeRepoInfo {
        forge, owner, repo, ..
    } = forge_repo_info;
    match forge {
        ForgeName::GitHub => {

View on GitHub (pinned to 58e5313667)