gitbutlerapp/gitbutler · warning
Repository labels for forge
Error message
Repository labels for forge {forge:?} are not implemented yet. What it means
`list_repository_labels` only implements label listing for GitHub; every other `ForgeName` falls into the wildcard `_` arm and returns this anyhow error. It signals an unimplemented feature for that forge, not a runtime fault — the operation simply has no code path for e.g. GitLab or Bitbucket yet.
Solutions
- Implement the `_` arm for the target forge by delegating to that forge's label-listing API, mirroring the GitHub branch.
- Guard in the caller: only invoke repository-label listing when the project's forge is GitHub, and show a 'not supported' state otherwise.
- If the repo actually is GitHub-hosted, check why forge detection classified it otherwise and fix the detection/config.
Example fix
// before: hits the unimplemented arm
let labels = list_repository_labels(forge, ...)?; // panics-free but errors for GitLab
// after: check forge first
if forge != ForgeName::GitHub {
return Err(Error::msg(format!("Label listing unsupported for {forge:?}")));
}
let labels = list_repository_labels(forge, ...)?; Defensive patterns
Strategy: validation
Validate before calling
// Rust: check forge support before calling
fn supports_repo_labels(forge: ForgeName) -> bool {
matches!(forge, ForgeName::GitHub)
} Try / catch
match list_repository_labels(forge, owner, repo, storage).await {
Ok(labels) => labels,
Err(e) if e.to_string().contains("not implemented") => {
Vec::new() // degrade gracefully: no label support for this forge
}
Err(e) => return Err(e),
} Prevention
- Check the forge type before offering label features in the UI
- Track unsupported-forge arms explicitly instead of wildcard `_` matches so new forges are compile-time errors
- Add a capabilities/capability-flag per forge so callers can query support instead of catching errors
When it happens
Trigger: Calling the repository-labels listing function with `forge` set to anything other than `ForgeName::GitHub` (e.g. GitLab, Bitbucket, or a project whose detected forge is not GitHub).
Common situations: A user opens the label picker on a GitLab or Bitbucket project in the desktop app; a repo is misdetected as a non-GitHub forge; a caller hardcodes or misconfigures the forge enum for a GitHub repo.
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
- Review labels for forge
- Fetching repo info for forge
- Listing ci checks for forge
- a committed transaction always materializes a workspace
- anchor is always present in the order at this point
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/b6f46089a1207711.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-forge/src/review.rs:1314
}
/// 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 58e5313667)