{"record":{"id":"5f08965c2316e8e8","repo":"gitbutlerapp/gitbutler","slug":"configured-target-branch-has-no-branch-name","errorCode":null,"errorMessage":"Configured target branch has no branch name","messagePattern":"Configured target branch has no branch name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/land/mod.rs","lineNumber":197,"sourceCode":") -> anyhow::Result<BranchLandResult> {\n    let base_branch = {\n        let mut guard = ctx.exclusive_worktree_access();\n        {\n            let (_repo, ws, _db) = ctx.workspace_and_db_with_perm(guard.read_permission())?;\n            if !ws.kind.has_managed_ref() {\n                bail!(\n                    \"`but merge` requires an active GitButler workspace (`gitbutler/workspace`). \\\n                     Switch into the workspace and try again.\"\n                );\n            }\n        }\n        crate::legacy::virtual_branches::get_base_branch_data(ctx, guard.write_permission())?\n            .ok_or_else(|| anyhow::anyhow!(\"No base branch configured\"))?\n    };\n\n    let target_branch_name = base_branch.short_name.clone();\n    if target_branch_name.is_empty() {\n        bail!(\"Configured target branch has no branch name\");\n    }\n    let fetch_remote_name = base_branch.remote_name.clone();\n    let push_remote_name = if base_branch.push_remote_name.is_empty() {\n        fetch_remote_name.clone()\n    } else {\n        base_branch.push_remote_name.clone()\n    };\n    if push_remote_name.is_empty() {\n        bail!(\"Configured target branch has no push remote\");\n    }\n\n    // Triangular remotes (fetch remote != push remote) are out of scope for now: the post-land\n    // reconcile reads the fetch remote's tracking ref, so a push to a different remote would not\n    // advance it and the reconcile would silently no-op. Refuse before mutating anything.\n    if push_remote_name != fetch_remote_name {\n        bail!(\n            \"`but merge` does not yet support triangular remotes (fetch `{fetch_remote_name}`, \\\n             push `{push_remote_name}`). Merge via a pull request instead, or configure a single \\","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/land/mod.rs#L179-L215","documentation":"The target (base) branch metadata from the workspace configuration must include a branch name, since landing merges into it and computes ref names from it. `branch_land` bails when `base_branch.short_name` is empty, meaning the configured target branch entry is malformed.","triggerScenarios":"Calling `but merge` when the workspace's base-branch data has an empty `short_name` — a corrupted or incompletely written `virtual_branches.toml` target entry, or an empty parsed branch name.","commonSituations":"Hand-edited or corrupted GitButler config file; an interrupted setup that wrote the target without a branch name; old config format migrated poorly.","solutions":["Re-configure the target branch in GitButler (set push/fetch target via the app or `but` target setup) so a branch name is stored","Inspect the workspace metadata (virtual_branches.toml / target config) and fix the empty branch name","As a workaround, delete the stale target entry and re-add it pointing at the correct remote branch"],"exampleFix":"// before (corrupted metadata)\n{\"target\": {\"branch\": \"\", \"remote\": \"origin\"}}\n// after\n{\"target\": {\"branch\": \"main\", \"remote\": \"origin\"}}","handlingStrategy":"validation","validationCode":"// read workspace target metadata before calling\nlet short_name = base_branch.short_name.clone();\nif short_name.is_empty() {\n    println!(\"target branch misconfigured; re-set the push target\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match land_result {\n    Err(e) if e.to_string().contains(\"has no branch name\") => {\n        reconfigure_target_branch();\n        retry_land();\n    }\n    other => other?,\n}","preventionTips":["Avoid hand-editing GitButler metadata files; use the app/CLI to set the target","After setup, print or assert the configured target branch name","Back up virtual_branches.toml before manual migrations"],"tags":["gitbutler","config","workspace","landing"],"backgroundTag":"invalid-config-value","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"}