gitbutlerapp/gitbutler · error · anyhow::Error

Repository labels for forge {forge:?} are not implemented ye

Error message

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

What it means

but-forge's `list_repo_labels()` dispatches the forge-agnostic 'list repository labels' operation per forge. Only the `ForgeName::GitHub` arm is wired up (it calls `but_github::pr::list_repo_labels`); GitLab, Bitbucket and Azure fall into the wildcard arm, which fails fast with this anyhow error before any network call is made.

Source

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

}

/// List the labels defined on the repository backing a review.
pub async fn list_repo_labels(
    preferred_forge_user: &Option<crate::ForgeUser>,
    forge_repo_info: &crate::forge::ForgeRepoInfo,
    storage: &but_forge_storage::Controller,
) -> 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::list_repo_labels(preferred_account, owner, repo, storage).await?;
            Ok(labels.into_iter().map(Into::into).collect())
        }
        _ => Err(anyhow::anyhow!(
            "Repository labels for forge {forge:?} are not implemented yet."
        )),
    }
}

/// Add labels to a review; returns the resulting label set.
pub async fn add_review_labels(
    preferred_forge_user: &Option<crate::ForgeUser>,
    forge_repo_info: &crate::forge::ForgeRepoInfo,
    review_number: usize,
    labels: &[String],
    storage: &but_forge_storage::Controller,
) -> Result<Vec<ForgeReviewLabel>> {
    let crate::forge::ForgeRepoInfo {
        forge, owner, repo, ..
    } = forge_repo_info;
    match forge {
        ForgeName::GitHub => {

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Use a GitHub-hosted repository — repository labels are GitHub-only in but-forge today.
  2. Gate the caller: hide or skip the label feature when `ForgeRepoInfo.forge` is not `ForgeName::GitHub`.
  3. Implement the backend: add a `but_gitlab::`/`but_bitbucket::` label-listing call and extend the match arm at crates/but-forge/src/review.rs:1108-1116.
  4. Bypass the abstraction and query the forge's native label API directly for non-GitHub repos.

Example fix

// before
let labels = but_forge::review::list_repo_labels(&user, &info, &storage).await?;

// after
let labels = match info.forge {
    ForgeName::GitHub => but_forge::review::list_repo_labels(&user, &info, &storage).await?,
    _ => Vec::new(), // repository labels are GitHub-only; hide the picker
};
Defensive patterns

Strategy: validation

Validate before calling

use but_forge::forge::ForgeName;

if !matches!(info.forge, ForgeName::GitHub) {
    // hide the repository label UI instead of calling list_repo_labels
}

Type guard

fn repo_labels_supported(forge: &but_forge::forge::ForgeName) -> bool {
    matches!(forge, ForgeName::GitHub)
}

Try / catch

match but_forge::review::list_repo_labels(&user, &info, &storage).await {
    Ok(labels) => labels,
    Err(e) if e.to_string().contains("not implemented yet") => Vec::new(), // unsupported forge
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `but_forge::review::list_repo_labels` (or any SDK/Tauri/CLI endpoint wrapping it) with `ForgeRepoInfo.forge` set to GitLab, Bitbucket or Azure — for example the label picker opened on a repo whose remote resolves to gitlab.com or bitbucket.org. The GitHub arm never produces this error.

Common situations: Assuming every `ForgeName` variant supports the full review API; UI surfaces (label pickers) rendered uniformly for all forges; forge auto-detection from the remote URL selecting a non-GitHub forge; new forge integrations added to the enum without label backends.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/b6f46089a1207711. Report an issue: GitHub.