{"record":{"id":"2698d37c28971696","repo":"gitbutlerapp/gitbutler","slug":"no-base-branch-configured-2698d3","errorCode":null,"errorMessage":"No base branch configured","messagePattern":"No base branch configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/land/mod.rs","lineNumber":58,"sourceCode":"        }\n\n        let id_map = IdMap::new_from_context(ctx, guard.read_permission())?;\n        let resolved_ids = id_map.parse_using_context(branch_id, ctx)?;\n        if resolved_ids.is_empty() {\n            bail!(\"Could not find branch: {branch_id}\");\n        }\n        if resolved_ids.len() > 1 {\n            bail!(\"Ambiguous branch '{branch_id}', matches multiple items\");\n        }\n\n        let branch_name = match &resolved_ids[0] {\n            CliId::Branch(branch) => branch.name.clone(),\n            other => bail!(\"Expected a branch ID, got {}\", other.kind_for_humans()),\n        };\n\n        let base_branch =\n            but_api::legacy::virtual_branches::get_base_branch_data(ctx, guard.write_permission())?\n                .ok_or_else(|| anyhow::anyhow!(\"No base branch configured\"))?;\n        (branch_name, base_branch)\n    };\n\n    // Display strings for the prompt and the final report. The API recomputes the target/remote\n    // configuration internally; the CLI only needs these names to describe what's about to happen.\n    let target_branch_name = base_branch.short_name.clone();\n    let push_remote_name = if base_branch.push_remote_name.is_empty() {\n        base_branch.remote_name.clone()\n    } else {\n        base_branch.push_remote_name.clone()\n    };\n    let target_display = format!(\"{push_remote_name}/{target_branch_name}\");\n\n    // With --whole-stack the confirmation must disclose everything that will be published, not\n    // just the branch the user typed — including commits on segments that no longer have a name.\n    // The API re-derives and enforces this; what's gathered here is display.\n    let lower = if whole_stack {\n        but_api::land::lower_stack(ctx, &branch_name)?","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/land/mod.rs#L40-L76","documentation":"`but land` resolves the requested branch id, then asks `but_api::legacy::virtual_branches::get_base_branch_data` for the workspace's base (target) branch. A `None` return — no target branch configured in this workspace — is turned into this error, because landing needs a target to land onto.","triggerScenarios":"Running `but land <branch>` in a repo whose GitButler workspace was never initialized with a target ref: skipped or interrupted onboarding, cloned repo without workspace config, or target cleared while branches remained.","commonSituations":"New clone where the setup flow was skipped; workspace metadata deleted or partially restored; CI checking out a fresh clone and running land directly; running from a directory that is not the managed repo root.","solutions":["Set the target branch: `but config target <branch>` (e.g. `but config target origin/main`)","Make sure the remote branch exists locally first: `git fetch <remote>`","Verify with `but config target` that a base branch is now reported","Re-run `but land <branch>`"],"exampleFix":"# before\nbut land my-branch\n# error: No base branch configured\n\n# after\nbut config target origin/main\nbut land my-branch","handlingStrategy":"validation","validationCode":"# Preflight: a configured target is required before landing\ngit fetch origin\nbut config target origin/main   # idempotent setup if unset\nbut land my-branch","typeGuard":null,"tryCatchPattern":"// Surface setup guidance when land fails on missing target\nlet out = Command::new(\"but\").args([\"land\", branch]).output()?;\nif !out.status.success()\n    && String::from_utf8_lossy(&out.stderr).contains(\"No base branch configured\")\n{\n    eprintln!(\"run `but config target <remote/branch>` first\");\n}","preventionTips":["Run the onboarding/setup flow right after cloning","Treat 'No base branch configured' as a setup signal — script the `but config target` step","Confirm you are in the root of a GitButler-managed workspace before landing"],"tags":["workspace","target-branch","configuration","land"],"backgroundTag":"target-branch-not-configured","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}