{"record":{"id":"5627b88d117791bf","repo":"gitbutlerapp/gitbutler","slug":"no-commits-were-provided-to-squash","errorCode":null,"errorMessage":"No commits were provided to squash","messagePattern":"No commits were provided to squash","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/commit/squash.rs","lineNumber":54,"sourceCode":"        guard.write_permission(),\n    )\n}\n\n/// Squash `subject_commit_ids` into `target_commit_id` under caller-held\n/// exclusive repository access.\n///\n/// This variant does not create an oplog entry. When `dry_run` is enabled, it\n/// returns a preview of the resulting workspace state without materializing the rebases.\npub fn commit_squash_only_with_perm(\n    ctx: &mut but_ctx::Context,\n    subject_commit_ids: Vec<gix::ObjectId>,\n    target_commit_id: gix::ObjectId,\n    how_to_combine_messages: MessageCombinationStrategy,\n    dry_run: DryRun,\n    perm: &mut RepoExclusive,\n) -> anyhow::Result<CommitSquashResult> {\n    if subject_commit_ids.is_empty() {\n        anyhow::bail!(\"No commits were provided to squash\")\n    }\n    let mut meta = ctx.meta()?;\n    let (repo, mut ws, mut db) = ctx.workspace_mut_and_db_mut_with_perm(perm)?;\n    let editor = Editor::create(&mut ws, &mut meta, &repo, &mut db)?;\n    let SquashCommitsOutcome {\n        rebase,\n        commit_selector,\n    } = but_workspace::commit::squash_commits(\n        editor,\n        subject_commit_ids,\n        target_commit_id,\n        how_to_combine_messages,\n    )?;\n    let new_commit = rebase.lookup_pick(commit_selector)?;\n    let workspace = WorkspaceState::from_successful_rebase(rebase, &repo, dry_run)?;\n\n    Ok(CommitSquashResult {\n        new_commit,","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/commit/squash.rs#L36-L72","documentation":"Squashing combines the changes of multiple commits into a target commit; it needs at least one source commit. `commit_squash_only_with_perm` checks the input list upfront and bails if empty, since a squash of zero commits has no meaningful outcome.","triggerScenarios":"Calling `commit_squash_only` / `commit_squash_with_perm` with an empty `subject_commit_ids` vector, e.g. when the UI sends no selected commits to squash into `target_commit_id`.","commonSituations":"User clicks 'squash' with no sibling commits selected; automated tooling computing the set of commits to squash via a query that returned nothing.","solutions":["Populate `subject_commit_ids` with at least one commit ID before calling squash","Guard the call site: if the list is empty, skip the operation and inform the user","Verify the commit-selection query (e.g. UI state) is correctly populated before dispatching the action"],"exampleFix":"// before\nlet result = squash(ctx, target_id, selected, strategy, dry_run)?;\n// after\nanyhow::ensure!(!selected.is_empty(), \"Select at least one commit to squash\");\nlet result = squash(ctx, target_id, selected, strategy, dry_run)?;","handlingStrategy":"validation","validationCode":"anyhow::ensure!(!subject_commit_ids.is_empty(), \"select at least one commit to squash\");","typeGuard":null,"tryCatchPattern":"if let Err(e) = api.commit_squash_only(ctx, ids, target, strategy, dry_run) {\n    if e.to_string().contains(\"No commits were provided\") { show_empty_selection_hint(); }\n    else { return Err(e); }\n}","preventionTips":["Gate squash actions behind a non-empty selection check","Log the commit-selection state when dispatching to catch filtering bugs early","Keep target_commit_id and subject list validation in one helper at the call site"],"tags":["validation","empty-input","squash"],"backgroundTag":"missing-required-argument","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"}