{"record":{"id":"2c0ab4e88b8e0f1d","repo":"gitbutlerapp/gitbutler","slug":"line-line-number-invalid-merge-commit-err","errorCode":null,"errorMessage":"line {line_number}: invalid merge commit: {err}","messagePattern":"line (.+?): invalid merge commit: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":73,"sourceCode":"                    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| {\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 {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L55-L91","documentation":"Thrown while parsing an edited interactive integration script when a 'merge' line names a commit that cannot be resolved against the allowed candidate commits. Like the pick case, resolve_commit must map the token unambiguously to one of the commits eligible for integration.","triggerScenarios":"parse_integration_steps_script encountering a line 'merge <commit>' where resolve_commit fails: unknown or ambiguous hash, or a hash that is not among the editable candidate commits of the divergence.","commonSituations":"Hand-editing the integration todo and mangling a hash; using an abbreviation that matches multiple candidates; referencing an upstream commit that is not part of the current integration candidate set; pasting merge lines from another todo file.","solutions":["Fix the merge line's commit argument to an unambiguous hash of an allowed candidate commit.","Copy the exact hash from the original rendered script instead of retyping it.","Delete the invalid merge line if the merge is not wanted.","Pre-validate the edited script with parse_integration_steps_script before accepting the editor buffer."],"exampleFix":"// before\nmerge 9f2c   // ambiguous\n// after\nmerge 9f2c8d41e5b34f0a9c1d2e3f4a5b6c7d8e9f0a1b  // full hash from rendered script","handlingStrategy":"validation","validationCode":"// validate merge lines before saving the edited script\nfn valid_merge(line: &str, allowed: &HashSet<String>) -> bool {\n    let tok = line.split_whitespace().nth(1).unwrap_or(\"\");\n    allowed.iter().any(|c| c.starts_with(tok) && tok.len() >= 4)\n}","typeGuard":null,"tryCatchPattern":"match parse_integration_steps_script(&edited, &divergence) {\n    Err(e) if e.to_string().contains(\"invalid merge commit\") => {\n        reopen_editor_with_error_note(&e.to_string())?;\n    }\n    other => other?,\n}","preventionTips":["Copy merge hashes from the rendered script verbatim.","Use full hashes when editing by hand.","Keep merge lines pointing only at divergence candidate commits.","Validate the whole script before accepting the editor buffer."],"tags":["parsing","git","integration","validation"],"backgroundTag":"invalid-argument-value","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"}