{"record":{"id":"98b1ef80aa80a59f","repo":"gitbutlerapp/gitbutler","slug":"line-line-number-squash-requires-at-least-two-c","errorCode":null,"errorMessage":"line {line_number}: squash requires at least two commits","messagePattern":"line (.+?): squash requires at least two commits","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":79,"sourceCode":"                if message_part.is_some() {\n                    bail!(\"line {line_number}: merge does not accept a message clause\");\n                }\n                if arguments.len() != 1 {\n                    bail!(\"line {line_number}: merge requires exactly one commit\");\n                }\n                let commit = arguments\n                    .first()\n                    .copied()\n                    .expect(\"validated merge arity above\");\n                InteractiveIntegrationStep::Merge {\n                    commit_id: resolve_commit(commit, &allowed_commits).map_err(|err| {\n                        anyhow::anyhow!(\"line {line_number}: invalid merge commit: {err}\")\n                    })?,\n                }\n            }\n            \"squash\" => {\n                if arguments.len() < 2 {\n                    bail!(\"line {line_number}: squash requires at least two commits\");\n                }\n                let commits = arguments\n                    .iter()\n                    .map(|commit| {\n                        resolve_commit(commit, &allowed_commits).map_err(|err| {\n                            anyhow::anyhow!(\n                                \"line {line_number}: invalid squash commit '{commit}': {err}\"\n                            )\n                        })\n                    })\n                    .collect::<Result<Vec<_>>>()?;\n                InteractiveIntegrationStep::Squash {\n                    commits,\n                    message: message_part\n                        .map(parse_message_clause)\n                        .transpose()\n                        .map_err(|err| {\n                            anyhow::anyhow!(\"line {line_number}: invalid squash message: {err}\")","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L61-L97","documentation":"A `squash` step combines two or more commits, so the parser rejects `squash` lines with fewer than two commit arguments. The error is raised before any commit resolution happens and includes the line number of the offending line.","triggerScenarios":"Calling parse_integration_steps_script with `squash` alone, or `squash <hash>` with only one commit. Also triggered when whitespace-only tokens follow `squash <hash>` so that only one real argument remains.","commonSituations":"A user deletes one of the hashes from a squash line while editing, intending to keep a single commit and not realizing a lone commit needs `pick` instead, or leaves a partially-removed squash line behind.","solutions":["Add a second (or more) commit hash to the `squash` line: `squash <hash1> <hash2>`.","If only one commit remains, replace `squash <hash>` with `pick <hash>` (and optionally `merge` for upstream commits).","Remove the line if the step is no longer needed."],"exampleFix":"// before (script text)\nsquash 2222222\n// after\nsquash 2222222 3333333","handlingStrategy":"validation","validationCode":"function validateSquashArity(line: string, lineNo: number): string | null {\n  const [cmd, ...args] = line.split('|')[0].trim().split(/\\s+/).filter(Boolean);\n  if (cmd !== 'squash') return null;\n  if (args.length < 2) return `line ${lineNo}: squash requires at least two commits`;\n  return null;\n}","typeGuard":"const squashHasTwoPlusCommits = (line: string): boolean => {\n  const [cmd, ...args] = line.split('|')[0].trim().split(/\\s+/).filter(Boolean);\n  return cmd === 'squash' && args.length >= 2;\n};","tryCatchPattern":"try {\n  const steps = await parseIntegrationScript(script, divergence);\n} catch (err) {\n  const m = /line (\\d+): squash requires at least two commits/.exec(String(err));\n  if (m) showEditorErrorAtLine(Number(m[1]), 'squash needs 2+ commits, or convert to pick');\n  else throw err;\n}","preventionTips":["Downgrade a single-commit squash to `pick <hash>` when deleting one of its hashes.","Keep at least two hashes on every squash line you edit.","Preview the script with the UI's divergence listing so you know which hashes exist."],"tags":["parsing","script-validation","arity","git"],"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"}