{"record":{"id":"27295d3f5094db3d","repo":"gitbutlerapp/gitbutler","slug":"line-line-number-merge-requires-exactly-one-com","errorCode":null,"errorMessage":"line {line_number}: merge requires exactly one commit","messagePattern":"line (.+?): merge requires exactly one commit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":65,"sourceCode":"                if arguments.len() != 1 {\n                    bail!(\"line {line_number}: pick requires exactly one commit\");\n                }\n                let commit = arguments\n                    .first()\n                    .copied()\n                    .expect(\"validated pick arity above\");\n                InteractiveIntegrationStep::Pick {\n                    commit_id: resolve_commit(commit, &allowed_commits).map_err(|err| {\n                        anyhow::anyhow!(\"line {line_number}: invalid pick commit: {err}\")\n                    })?,\n                }\n            }\n            \"merge\" => {\n                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| {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L47-L83","documentation":"The integration script parser requires a `merge` line to name exactly one commit argument. This error is raised when a `merge` line has zero arguments (just `merge`) or more than one (e.g. `merge a b`). Like the `pick` arity check, the message includes the line number for easy correction.","triggerScenarios":"Calling parse_integration_steps_script with a script containing `merge` with no hash, `merge <a> <b>`, or a `merge` line whose commit token is missing (e.g. deleted during editing).","commonSituations":"A user editing the rendered script deletes the hash but leaves the keyword, adds multiple hashes thinking merge accepts several, or an editor auto-complete leaves an incomplete line.","solutions":["Edit the line so `merge` is followed by exactly one commit hash from the editable divergence (e.g. `merge 4444444`).","Use `squash <hash1> <hash2> ...` if you intended to combine multiple commits, not merge.","Remove the line if the merge step is no longer wanted."],"exampleFix":"// before (script text)\nmerge\n// after\nmerge 4444444","handlingStrategy":"validation","validationCode":"function validateMergeArity(line: string, lineNo: number): string | null {\n  const tokens = line.trim().split(/\\s+/).filter(Boolean);\n  if (tokens[0] !== 'merge') return null;\n  if (tokens.length !== 2) return `line ${lineNo}: merge requires exactly one commit`;\n  return null;\n}","typeGuard":"const isMergeWithOneArg = (line: string): boolean =>\n  line.trim().split(/\\s+/).filter(Boolean).length === 2 && line.trim().startsWith('merge ');","tryCatchPattern":"try {\n  const steps = await parseIntegrationScript(script, divergence);\n} catch (err) {\n  const m = /line (\\d+): merge requires exactly one commit/.exec(String(err));\n  if (m) showEditorErrorAtLine(Number(m[1]), 'merge must reference exactly one commit');\n  else throw err;\n}","preventionTips":["Keep exactly one hash after `merge`; delete the whole line to skip a step.","Do not delete just the hash when editing — remove the entire line or replace the hash.","Use `squash` when combining multiple commits is the goal."],"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"}