{"record":{"id":"7d2f707639a159e9","repo":"gitbutlerapp/gitbutler","slug":"committing-stack-assignments-is-not-supported-use","errorCode":null,"errorMessage":"committing stack assignments is not supported. Use `but commit`","messagePattern":"committing stack assignments is not supported\\. Use `but commit`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/status/tui/app/commit_mode.rs","lineNumber":515,"sourceCode":"    ctx: &mut Context,\n    terminal_guard: &mut T,\n    messages: &mut Vec<Message>,\n    mode: &CommitMode,\n    commit_op: commit::CommitOperation,\n    stack_on_head: bool,\n) -> anyhow::Result<()>\nwhere\n    T: TerminalGuard,\n    anyhow::Error: From<<T::Backend as Backend>::Error>,\n{\n    let CommitMode {\n        source,\n        message_composer,\n        insert_side: _,\n        scope_to_stack,\n    } = mode;\n\n    anyhow::ensure!(\n        scope_to_stack.is_none(),\n        \"committing stack assignments is not supported. Use `but commit`\"\n    );\n\n    let commit_selection = match &**source {\n        // Marks can span checkouts, so this is where that gets rejected.\n        CommitSource::Marks(hunks) => commit::CommitSelection::Changes(Box::new(\n            UncommittedSelection::new(hunks.clone()).map_err(CliError::into_internal)?,\n        )),\n        CommitSource::Uncommitted => commit::CommitSelection::AllChanges(ChangeSourceId::Head),\n        CommitSource::Worktree(name) => {\n            commit::CommitSelection::AllChanges(ChangeSourceId::Worktree(name.clone()))\n        }\n        CommitSource::UncommittedHunk(hunk) => commit::CommitSelection::Changes(Box::new(\n            UncommittedSelection::new(NonEmpty::new(hunk.clone()))\n                .map_err(CliError::into_internal)?,\n        )),\n    };","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/status/tui/app/commit_mode.rs#L497-L533","documentation":"The legacy TUI commit flow explicitly rejects committing when the current selection is scoped to a stack assignment (scope_to_stack is Some). Stack assignments are only supported by the `but commit` command, so the TUI refuses at confirmation time and points the user to that command.","triggerScenarios":"Confirming a commit in the TUI commit mode while a stack scope is active, e.g. after selecting a stack/worktree assignment and then hitting the commit confirmation key.","commonSituations":"Workflows that mix TUI hunk selection with stack assignments; older workflows where the TUI accepted stack-scoped commits before they were moved to `but commit`.","solutions":["Use `but commit` with the same stack selection instead of the TUI confirm","Clear the stack scope: reselect plain hunks or uncommitted files, then confirm from the TUI","Check `but status` to see what is currently scoped before committing"],"exampleFix":"# before: TUI commit confirm with a stack scope selected -> error\n# after:\nbut commit <stack-id>","handlingStrategy":"validation","validationCode":"if mode.scope_to_stack.is_some() {\n    // do not enter TUI commit confirmation; route to `but commit <stack-id>`\n    return route_to_but_commit(mode.scope_to_stack.unwrap());\n}","typeGuard":null,"tryCatchPattern":"anyhow::ensure!(scope_to_stack.is_none(), \"committing stack assignments is not supported. Use `but commit`\"); — enforce at commit-mode entry so the user learns the constraint before composing a message, not after.","preventionTips":["Gate commit-mode entry on scope_to_stack.is_none()","Programmatically route stack-scoped selections to `but commit`"],"tags":["commit","tui","stack-assignments","validation"],"backgroundTag":"unsupported-operation-rejected","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}