{"record":{"id":"c18c3524425295ca","repo":"gitbutlerapp/gitbutler","slug":"commits-cannot-be-moved-to-the-merge-base","errorCode":null,"errorMessage":"commits cannot be moved to the merge base","messagePattern":"commits cannot be moved to the merge base","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/status/tui/app/move_mode.rs","lineNumber":393,"sourceCode":"\n        Ok(())\n    }\n}\n\nfn move_target(\n    target: MoveTarget<'_>,\n    insert_side: InsertSide,\n) -> anyhow::Result<r#move::MoveTarget> {\n    Ok(match target {\n        MoveTarget::Branch { name } => r#move::MoveTarget::BranchTip {\n            name: Category::LocalBranch.to_full_name(name)?,\n        },\n        MoveTarget::Commit(commit) => r#move::MoveTarget::Commit {\n            commit,\n            side: targeting::Side::from(insert_side),\n        },\n        MoveTarget::WorktreeTip(name) => r#move::MoveTarget::BranchTip { name },\n        MoveTarget::MergeBase => anyhow::bail!(\"commits cannot be moved to the merge base\"),\n    })\n}\n\nfn move_with(\n    ctx: &mut Context,\n    move_op: MoveOperation,\n) -> anyhow::Result<Option<SelectAfterReload>> {\n    let mut guard = ctx.exclusive_worktree_access();\n    let mut meta = ctx.meta()?;\n    let (outcome, _ws) = r#move::run(ctx, &mut meta, guard.write_permission(), move_op)?;\n\n    Ok(match outcome {\n        MoveOperationOutcome::Commits { moved_commits, .. } => {\n            Some(SelectAfterReload::Commit(moved_commits.head.commit_id))\n        }\n        MoveOperationOutcome::Changes { new_commit, .. } => {\n            Some(SelectAfterReload::Commit(new_commit.commit_id))\n        }","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/status/tui/app/move_mode.rs#L375-L411","documentation":"In the status TUI's move mode (crates/but/src/command/legacy/status/tui/app/move_mode.rs:393), the selected target is converted to a move::MoveTarget; the merge-base lane (MoveTarget::MergeBase) is deliberately rejected because commits can only be moved onto a branch tip, a commit (with an insert side), or a linked-worktree tip — never onto the merge base itself.","triggerScenarios":"Entering move mode and accepting the merge-base/merge-commit row as the destination; a keybinding or selection handler that allows the merge-base heading to be picked as a move target.","commonSituations":"Users trying to move a commit to the very bottom of a stack; new key handlers or fuzzy selectors that do not filter out the merge-base lane.","solutions":["Choose a concrete commit or branch tip as the move target.","To move a commit to the bottom of a stack, target the first commit of that stack instead.","Fix the selection UI so the merge-base lane is non-selectable in move mode, preventing the error entirely."],"exampleFix":"// before\nlet target = MoveTarget::MergeBase; // then converted -> bails\n\n// after\nlet target = MoveTarget::Commit(first_commit_of_stack);","handlingStrategy":"validation","validationCode":"if matches!(target, MoveTarget::MergeBase) {\n    // exclude merge-base lanes from selectable move targets in the UI\n    return Ok(());\n}","typeGuard":"fn is_valid_move_target(target: &MoveTarget<'_>) -> bool {\n    !matches!(target, MoveTarget::MergeBase)\n}","tryCatchPattern":"if let Err(err) = move_with(&mut ctx, move_op) {\n    if err.to_string().contains(\"merge base\") {\n        // re-enter move mode and prompt for a commit/branch-tip target\n    } else { return Err(err); }\n}","preventionTips":["Filter merge-base rows out of move-target selection in the TUI.","Route 'move to bottom of stack' intents to the first commit of the stack.","Unit-test the MoveTarget conversion for every variant."],"tags":["tui","move","rebase","target","invariant"],"backgroundTag":"unsupported-move-target","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}