{"record":{"id":"b6f46089a1207711","repo":"gitbutlerapp/gitbutler","slug":"repository-labels-for-forge-forge-are-not-impl","errorCode":null,"errorMessage":"Repository labels for forge {forge:?} are not implemented yet.","messagePattern":"Repository labels for forge (.+?) are not implemented yet\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but-forge/src/review.rs","lineNumber":1314,"sourceCode":"}\n\n/// List the labels defined on the repository backing a review.\npub async fn list_repo_labels(\n    preferred_forge_user: &Option<crate::ForgeUser>,\n    forge_repo_info: &crate::forge::ForgeRepoInfo,\n    storage: &but_forge_storage::Controller,\n) -> Result<Vec<ForgeReviewLabel>> {\n    let crate::forge::ForgeRepoInfo {\n        forge, owner, repo, ..\n    } = forge_repo_info;\n    match forge {\n        ForgeName::GitHub => {\n            let preferred_account = preferred_forge_user.as_ref().and_then(|user| user.github());\n            let labels =\n                but_github::pr::list_repo_labels(preferred_account, owner, repo, storage).await?;\n            Ok(labels.into_iter().map(Into::into).collect())\n        }\n        _ => Err(anyhow::anyhow!(\n            \"Repository labels for forge {forge:?} are not implemented yet.\"\n        )),\n    }\n}\n\n/// Add labels to a review; returns the resulting label set.\npub async fn add_review_labels(\n    preferred_forge_user: &Option<crate::ForgeUser>,\n    forge_repo_info: &crate::forge::ForgeRepoInfo,\n    review_number: usize,\n    labels: &[String],\n    storage: &but_forge_storage::Controller,\n) -> Result<Vec<ForgeReviewLabel>> {\n    let crate::forge::ForgeRepoInfo {\n        forge, owner, repo, ..\n    } = forge_repo_info;\n    match forge {\n        ForgeName::GitHub => {","sourceCodeStart":1296,"sourceCodeEnd":1332,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-forge/src/review.rs#L1296-L1332","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before: hits the unimplemented arm\nlet labels = list_repository_labels(forge, ...)?; // panics-free but errors for GitLab\n\n// after: check forge first\nif forge != ForgeName::GitHub {\n    return Err(Error::msg(format!(\"Label listing unsupported for {forge:?}\")));\n}\nlet labels = list_repository_labels(forge, ...)?;","handlingStrategy":"validation","validationCode":"// Rust: check forge support before calling\nfn supports_repo_labels(forge: ForgeName) -> bool {\n    matches!(forge, ForgeName::GitHub)\n}","typeGuard":null,"tryCatchPattern":"match list_repository_labels(forge, owner, repo, storage).await {\n    Ok(labels) => labels,\n    Err(e) if e.to_string().contains(\"not implemented\") => {\n        Vec::new() // degrade gracefully: no label support for this forge\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["unsupported-forge","labels","feature-not-implemented","rust"],"backgroundTag":"unsupported-operation","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"}