{"record":{"id":"ae462c613a651cd2","repo":"gitbutlerapp/gitbutler","slug":"but-land-requires-an-active-gitbutler-workspace-ae462c","errorCode":null,"errorMessage":"`but land` requires an active GitButler workspace (`gitbutler/workspace`). Switch into the workspace and try again.","messagePattern":"`but land` requires an active GitButler workspace \\(`gitbutler/workspace`\\)\\. Switch into the workspace and try again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/land/mod.rs","lineNumber":35,"sourceCode":"\npub fn handle(\n    ctx: &mut Context,\n    out: &mut OutputChannel,\n    branch_id: &str,\n    yes: bool,\n    no_ff: bool,\n    whole_stack: bool,\n) -> anyhow::Result<()> {\n    // Resolve the branch identifier and read the target configuration. The managed-workspace guard\n    // runs here for a friendly message before the prompt; the API enforces it again, along with the\n    // bottom-segment, conflicted-commit, and triangular-remote guards, before mutating anything.\n    let (branch_name, base_branch) = {\n        let mut guard = ctx.exclusive_worktree_access();\n\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 land` requires an active GitButler workspace (`gitbutler/workspace`). \\\n                     Switch into the workspace and try again.\"\n                );\n            }\n        }\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()),","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/land/mod.rs#L17-L53","documentation":"`but land` only operates on a GitButler-managed workspace: the project must carry the `gitbutler/workspace` ref that the GitButler app creates when it adopts a repository. The handler checks `ws.kind.has_managed_ref()` before prompting and bails with this friendly message; the API layer enforces the same guard again before mutating anything.","triggerScenarios":"Running `but land` in a plain git repository that was never opened/adopted by the GitButler app; in a repo whose workspace ref was deleted; from the wrong directory (a submodule, an unrelated clone, a nested repo).","commonSituations":"Trying the CLI against a repo used only with vanilla git; workspace refs removed by cleanup scripts or manual ref pruning; running land from a directory inside a different repository.","solutions":["Open/adopt the project once in the GitButler app so the `gitbutler/workspace` ref exists.","Run the command from the repository root GitButler manages; `but status` should list lanes there.","If you do not want a GitButler workspace, land with plain git (merge/push) instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Require a GitButler workspace before land commands\ngit show-ref 2>/dev/null | grep -q 'gitbutler/workspace' || { echo 'not a GitButler workspace'; exit 2; }\nbut land \"$branch\" --yes","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Adopt the repo in the GitButler app before using workspace commands like `but land`.","Sanity-check with `but status`: it must show lanes before land can work."],"tags":["cli","workspace","land","gitbutler"],"backgroundTag":"missing-workspace","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}