{"record":{"id":"df0fa0d89af974cf","repo":"gitbutlerapp/gitbutler","slug":"line-line-number-pick-requires-exactly-one-comm","errorCode":null,"errorMessage":"line {line_number}: pick requires exactly one commit","messagePattern":"line (.+?): pick requires exactly one commit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":48,"sourceCode":"        if trimmed.is_empty() || trimmed.starts_with('#') {\n            continue;\n        }\n\n        let (command_part, message_part) = split_message_clause(trimmed)\n            .with_context(|| format!(\"line {line_number}: invalid message clause\"))?;\n        let tokens = command_part.split_whitespace().collect::<Vec<_>>();\n        let Some(command) = tokens.first().copied() else {\n            continue;\n        };\n        let arguments = tokens.get(1..).unwrap_or_default();\n\n        let step = match command {\n            \"pick\" => {\n                if message_part.is_some() {\n                    bail!(\"line {line_number}: pick does not accept a message clause\");\n                }\n                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                }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L30-L66","documentation":"The integration script parser (`parse_integration_steps_script` in but-workspace) validates each non-comment line of the edited `pick`/`merge`/`squash` script. A `pick` line must name exactly one commit argument. This error is raised when the line contains zero or more than one argument (e.g. `pick` alone, or `pick a b`). The line number is included so the user's editor can pinpoint the bad line.","triggerScenarios":"Calling parse_integration_steps_script with a script containing `pick` with no argument, `pick <a> <b>` (two or more hashes), or trailing tokens that split as whitespace-separated arguments on a `pick` line.","commonSituations":"A user hand-editing the integration script in a text editor adds a second commit to a `pick` line, deletes the hash but leaves the command, or pastes in rebase-todo-style lines where `pick` is expected to accept extra options (like `pick -x <hash>` or fixup/reword keywords that the parser treats as arguments).","solutions":["Edit the offending line so `pick` is followed by exactly one commit hash from the editable divergence (e.g. `pick 3333333`).","If you meant to combine commits, use `squash <hash1> <hash2> ...` which accepts two or more commits.","If the extra tokens were options (like `-x` or a comment), move them to a `#` comment line, which the parser ignores.","Delete the line entirely if it is an empty `pick` with no commit."],"exampleFix":"// before (script text)\npick 3333333 4444444\n// after\npick 3333333\npick 4444444","handlingStrategy":"validation","validationCode":"function validatePickLine(line: string, lineNo: number): string | null {\n  const tokens = line.split(/\\s+/).filter(Boolean);\n  if (tokens[0] !== 'pick') return null;\n  if (tokens.length !== 2) return `line ${lineNo}: pick requires exactly one commit`;\n  return null;\n}","typeGuard":"const isPickWithOneArg = (line: string): boolean =>\n  line.trim().split(/\\s+/).filter(Boolean).length === 2 && line.trim().startsWith('pick ');","tryCatchPattern":"try {\n  const steps = await parseIntegrationScript(script, divergence);\n} catch (err) {\n  const m = /line (\\d+): pick requires exactly one commit/.exec(String(err));\n  if (m) showEditorErrorAtLine(Number(m[1]), 'pick must reference exactly one commit');\n  else throw err;\n}","preventionTips":["Edit only the hashes in rendered `pick` lines, never add or remove tokens.","Combine commits with `squash`, which accepts multiple hashes, instead of extending `pick`.","Never paste `git rebase -i` todo lines with extra flags into this script."],"tags":["parsing","script-validation","arity","git"],"backgroundTag":"invalid-cli-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"}