{"record":{"id":"e2834edcaa28e60c","repo":"gitbutlerapp/gitbutler","slug":"no-branch-found-for-id-branch-id","errorCode":null,"errorMessage":"No branch found for ID: {branch_id}","messagePattern":"No branch found for ID: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/forge/review.rs","lineNumber":469,"sourceCode":"        }\n    }\n    Ok(branches_without_prs)\n}\n\nfn get_branch_names(project: &Project, branch_id: &str) -> anyhow::Result<Vec<String>> {\n    let ctx = Context::new_from_legacy_project(project.clone())?;\n    let id_map = IdMap::legacy_new_from_context(&ctx)?;\n    let branch_ids = id_map\n        .parse_using_context(branch_id, &ctx)?\n        .iter()\n        .filter_map(|clid| match clid {\n            CliId::Branch(branch) => Some(branch.name.clone()),\n            _ => None,\n        })\n        .collect::<Vec<_>>();\n\n    if branch_ids.is_empty() {\n        anyhow::bail!(\"No branch found for ID: {branch_id}\");\n    }\n\n    Ok(branch_ids)\n}\n\n#[expect(clippy::too_many_arguments)]\npub async fn handle_multiple_branches_in_workspace(\n    ctx: &mut Context,\n    review_map: &std::collections::HashMap<String, Vec<but_forge::ForgeReview>>,\n    applied_stacks: &[HeadInfoStack],\n    skip_force_push_protection: bool,\n    with_force: bool,\n    run_hooks: bool,\n    default_message: bool,\n    draft: bool,\n    message: Option<&ForgeReviewMessage>,\n    out: &mut OutputChannel,\n    selected_branches: Option<Vec<String>>,","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/forge/review.rs#L451-L487","documentation":"Forge review commands that operate on lanes resolve the user-supplied ID through the IdMap and keep only results that are `CliId::Branch` (review.rs:462-468). If nothing survives the filter — the ID is unknown, or it resolved only to non-branch entities like commits or uncommitted files — the command bails with 'No branch found for ID'.","triggerScenarios":"Passing a commit ID or uncommitted-file ID where a branch/lane ID is required (branch-scoped review operations); a typo'd or stale short ID that no longer resolves to a lane in this workspace.","commonSituations":"Copying the wrong ID kind from `but status`; short IDs going stale after the workspace rebases or rewrites history; running the command in a different repo than the one `but status` was run in.","solutions":["Run `but status` in the same repo and copy an ID from the branches/lanes section.","If the ID looks right, refresh it: the workspace may have changed (rebase/squash) since you copied it.","Make sure you are in the right project directory; the IdMap is per-workspace."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Confirm the ID names a lane before running branch-scoped review commands\nbut status | grep -F '<id>' || { echo 'unknown or non-branch id'; exit 2; }","typeGuard":"// Narrow IdMap results to branches before use\nlet branches: Vec<_> = ids.into_iter().filter(|id| matches!(id, CliId::Branch(_))).collect();\nif branches.is_empty() {\n    // reject before calling the review API\n}","tryCatchPattern":null,"preventionTips":["Only pass lane/branch IDs (from the branches section of `but status`) to branch-scoped commands.","Refresh IDs after rebases or workspace updates; short IDs go stale.","Run commands from the same project directory the IDs came from."],"tags":["cli","id-resolution","forge","review","gitbutler"],"backgroundTag":"entity-not-found-by-id","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}