gitbutlerapp/gitbutler · error

committing stack assignments is not supported. Use `but…

Error message

committing stack assignments is not supported. Use `but commit`

What it means

In the TUI's commit mode, `commit_with` rejects commits made with a `scope_to_stack` assignment set: assigning changes to a whole stack/branch is not something the inline TUI commit supports, and the CLI `but commit` must be used instead. This is an intentional capability guard, not a bug.

Solutions

  1. use `but commit` on the command line instead, which supports stack assignment flows
  2. commit without the stack scope in the TUI, then reassign afterwards
  3. use `but assign` (CLI) to move changes between stacks, then commit normally

Example fix

// before (TUI) commit with scope-to-stack selected -> rejected
// after (shell)
but assign <file-id> <stack-id> && but commit -m "message"
Defensive patterns

Strategy: try-catch

Validate before calling

if commit_mode.scope_to_stack.is_some() {
    eprintln!("Use `but commit` from the CLI for stack-scoped commits");
}

Try / catch

match commit_with(ctx, mode) {
    Err(e) if e.to_string().contains("not supported. Use `but commit`") => {
        eprintln!("Fall back to `but assign` + `but commit` on the CLI.");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Committing in the TUI while the commit mode was opened with scope-to-stack assignment active (e.g. via `handle_commit_confirm` or `handle_commit_to_new_branch` with a stack-scoped selection).

Common situations: Selecting changes and choosing to assign them to another stack/branch during the commit flow in the TUI; attempting to restructure stack membership from the commit dialog.

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/7d2f707639a159e9. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/command/legacy/status/tui/app/commit_mode.rs:507

    ctx: &mut Context,
    terminal_guard: &mut T,
    messages: &mut Vec<Message>,
    mode: &CommitMode,
    commit_op: commit::CommitOperation,
    stack_on_head: bool,
) -> anyhow::Result<()>
where
    T: TerminalGuard,
    anyhow::Error: From<<T::Backend as Backend>::Error>,
{
    let CommitMode {
        source,
        message_composer,
        insert_side: _,
        scope_to_stack,
    } = mode;

    anyhow::ensure!(
        scope_to_stack.is_none(),
        "committing stack assignments is not supported. Use `but commit`"
    );

    let commit_selection = match &**source {
        // Marks can span checkouts, so this is where that gets rejected.
        CommitSource::Marks(hunks) => commit::CommitSelection::Changes(Box::new(
            UncommittedSelection::new(hunks.clone()).map_err(CliError::into_internal)?,
        )),
        CommitSource::UncommittedArea(source) => {
            commit::CommitSelection::AllChanges(source.clone())
        }
        CommitSource::UncommittedHunk(hunk) => commit::CommitSelection::Changes(Box::new(
            UncommittedSelection::new(NonEmpty::new(hunk.clone()))
                .map_err(CliError::into_internal)?,
        )),
    };

View on GitHub (pinned to 58e5313667)