gitbutlerapp/gitbutler · error

Moving a non-empty branch in single-branch mode is not yet…

Error message

Moving a non-empty branch in single-branch mode is not yet supported

What it means

In single-branch mode, move_branch_in_single_branch_mode can only reorder empty branch refs (pure display ordering). A branch that owns commits cannot be moved across stacks because that would change commit ownership and require a real rebase, which single-branch mode does not support - so it bails.

Solutions

  1. Enable managed multi-branch mode so the move can be performed with a real rebase
  2. Move the branch within its current stack only (same_stack moves are allowed)
  3. Rebase manually or use a different operation that supports commit ownership changes

Example fix

// before
move_branch(editor, subject, target) // subject has commits, cross-stack
// after
// enable managed workspace mode first, or keep target in the same stack
assert!(same_stack(source_stack, destination_stack));
move_branch(editor, subject, target)
Defensive patterns

Strategy: validation

Validate before calling

// in single-branch mode, only same-stack moves of commit-owning branches are allowed
if !subject_segment.commits.is_empty() && !same_stack(source_stack, dest_stack) {
    // cross-stack move of a non-empty branch: unsupported
}

Try / catch

match move_branch(editor, subject, target) {
    Err(e) if e.to_string().contains("single-branch mode is not yet supported") => switch_to_managed_mode_and_retry(),
    other => other?,
}

Prevention

When it happens

Trigger: Calling move_branch() while the workspace is in single-branch mode, where the subject branch has commits and the source and destination stacks differ (cross-stack move).

Common situations: Users trying to reorder/re-parent a non-empty branch between stacks while in single-branch (no workspace commit) mode; drag-and-drop of a commit-owning branch to a different stack in the UI.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/e4a9baa867340634. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-workspace/src/branch/move_branch.rs:244

    /// The reordered chain is returned in [`Outcome::branch_stack_order`] for the caller to persist
    /// (via [`RefMetadata::set_branch_stack_order`]) rather than being written here, so callers can
    /// skip persistence for dry-run previews.
    fn move_branch_in_single_branch_mode<'ws, 'meta, M: RefMetadata>(
        mut successful_rebase: SuccessfulRebase<'ws, 'meta, M>,
        workspace: but_graph::Workspace,
        source: WorkspaceSegmentContext,
        destination: WorkspaceSegmentContext,
        subject_branch_name: &FullNameRef,
        target_branch_name: &FullNameRef,
    ) -> anyhow::Result<Outcome<'ws, 'meta, M>> {
        let (source_stack, subject_segment) = &source;
        let (destination_stack, _) = &destination;
        let entrypoint = workspace.ref_name().map(ToOwned::to_owned);
        // A branch that owns commits can only be reordered within its current stack in
        // single-branch mode. Moving it across stacks would change commit ownership and needs a
        // real rebase.
        if !subject_segment.commits.is_empty() && !same_stack(source_stack, destination_stack) {
            bail!("Moving a non-empty branch in single-branch mode is not yet supported");
        }
        // Reordering same-target empty refs only changes which empty segment is displayed first.
        // If their targets differ, however, the subject crosses commit-owning segments and its ref
        // must move with it or those commits would be projected as belonging to the empty branch.
        let move_requires_graph_update = !subject_segment.commits.is_empty()
            || successful_rebase.reference_target(subject_branch_name)?
                != successful_rebase.reference_target(target_branch_name)?;
        let existing_order = {
            let (_repo, meta) = successful_rebase.repo_and_meta_mut();
            if !meta.can_persist_branch_stack_order() {
                bail!(
                    "Cannot reorder '{subject_branch_name}' in single-branch mode without branch order metadata"
                );
            }
            // Reorder against the existing chain. A movable subject is always part of `branch_order`
            // (that's what makes it a projected segment), so the first lookup normally succeeds. The
            // target and entrypoint lookups are defensive fallbacks so that, should the projection ever
            // surface a segment that isn't tracked yet, we extend the real chain instead of clobbering

View on GitHub (pinned to 58e5313667)