{"record":{"id":"b24bc9453899411e","repo":"gitbutlerapp/gitbutler","slug":"land-cancelled-messaging","errorCode":null,"errorMessage":"Land cancelled","messagePattern":"Land cancelled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/but/src/command/legacy/merge/messaging.rs","lineNumber":242,"sourceCode":"    }\n\n    if yes {\n        return Ok(());\n    }\n\n    let Some(mut inout) = out.prepare_for_terminal_input() else {\n        bail!(\n            \"Refusing to directly update {target_display} without confirmation. Re-run with --yes to confirm.\"\n        );\n    };\n\n    let question = if extras.is_empty() {\n        format!(\"Land {branch_name} directly onto {target_display}?\")\n    } else {\n        format!(\"Land {branch_name} and everything below it directly onto {target_display}?\")\n    };\n    if inout.confirm(question, ConfirmDefault::Yes)? == Confirm::No {\n        bail!(\"Land cancelled\");\n    }\n\n    Ok(())\n}\n\n/// The open pull-request numbers attached to `branch_name` or any of `lower_segments`. Landing\n/// deletes each landed branch's remote copy, which closes the attached reviews on the forge, so\n/// all are surfaced.\n///\n/// Only applied workspace segments can land, so this reads the forge review associations that\n/// `head_info` projects onto the workspace segments instead of computing the repository-wide\n/// branch listing. Only open reviews are surfaced: a segment's number can also be settled\n/// display identity (a landed review), which landing cannot close.\npub(super) fn attached_pr_numbers(\n    ctx: &Context,\n    branch_name: &str,\n    lower_segments: &[String],\n) -> anyhow::Result<Vec<(String, usize)>> {","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/merge/messaging.rs#L224-L260","documentation":"This error is raised by `confirm_direct_target_update` in the `but merge` CLI command when the user answers 'No' to the interactive confirmation prompt asking whether to land a branch (and optionally everything below it) directly onto the target branch. It is a deliberate, user-initiated abort, not a failure: the operation is cancelled before any refs are moved or anything is pushed. It exists so the landing is never performed without explicit consent when running interactively without `--yes`.","triggerScenarios":"Running `but merge <branch-id>` (without `--yes`) in a terminal and answering 'No' (or pressing a key that maps to No) at the prompt 'Land <branch> directly onto <remote>/<target>?' or 'Land <branch> and everything below it directly onto <remote>/<target>?'. The prompt is reached only when `extras` (extra branches below) may be affected and the output channel supports terminal input.","commonSituations":"A developer inspects the prompt, notices the landing would affect more branches than expected (extras listed in the warning above the prompt), and declines. A user changes their mind after seeing the target display name is the wrong remote/branch. Scripting/automation runs the command attached to a TTY without `--yes` and an automated answer of 'No' is fed in.","solutions":["Re-run the command and answer 'Yes' (the default) at the confirmation prompt if the landing is intended.","Add the `--yes` flag to skip interactive confirmation: `but merge <branch-id> --yes` (only when certain of the target).","Use `--whole-stack` only intentionally; if the prompt showed unwanted extras, land a single branch instead by omitting `--whole-stack`.","Verify the target with `but branch list` / `but base` if the displayed target was unexpected, then retry."],"exampleFix":"// before: interactive run cancelled by user\nbut merge branch-abc\n# Land branch-abc directly onto origin/main? [Y/n] n\n// after: explicit non-interactive confirmation\nbut merge branch-abc --yes","handlingStrategy":"try-catch","validationCode":"// Scripting: skip the interactive prompt entirely by passing --yes,\n// or pre-check that the command will prompt:\n// `but merge <id> --yes` avoids this error in non-interactive runs.\nconst args = hasConfirmed ? ['merge', branchId, '--yes'] : ['merge', branchId];","typeGuard":null,"tryCatchPattern":"try {\n  runBut(['merge', branchId]);\n} catch (e) {\n  if (e.stderr.includes('Land cancelled')) {\n    // user declined; treat as a no-op, not a failure\n    return;\n  }\n  throw e;\n}","preventionTips":["Pass --yes when the landing is intentional and the command runs non-interactively.","Read the warning above the prompt (attached PRs, extras below) before answering.","Use --whole-stack deliberately only when all lower branches should land too.","Verify target remote/branch display (push_remote/target) before confirming."],"tags":["cli","user-cancelled","confirmation-prompt","gitbutler"],"backgroundTag":"user-cancelled-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"}