gitbutlerapp/gitbutler · error
line : invalid pick commit
Error message
line {line_number}: invalid pick commit: {err} What it means
Thrown while parsing an edited interactive integration script when a 'pick' line names a commit that cannot be resolved against the set of editable candidate commits derived from the integration divergence. resolve_commit fails because the token is not an unambiguous abbreviation of one of the allowed commits.
Solutions
- Correct the commit argument on the reported line to the short hash of a commit listed in the divergence display.
- Use the full commit hash copied from the rendered script (render_integration_steps_script output) instead of a hand-typed abbreviation.
- Remove the invalid pick line if the commit is not needed.
- Programmatically validate hashes against editable_candidate_commits before saving the edited script.
Example fix
// before: edited script pick abc12 // ambiguous short hash // after pick abc123def4567890abcdef1234567890abcdef12 // full hash of an allowed commit
Defensive patterns
Strategy: validation
Validate before calling
// before saving an edited script, verify every pick hash resolves
fn valid_pick(line: &str, allowed: &HashSet<String>) -> bool {
let tok = line.split_whitespace().nth(1).unwrap_or("");
allowed.iter().any(|c| c.starts_with(tok) && tok.len() >= 4)
} Try / catch
match parse_integration_steps_script(&edited, &divergence) {
Err(e) if e.to_string().contains("invalid pick commit") => {
// reopen the editor with the original rendered script and the error shown
reopen_editor_with_error_note(&e.to_string())?;
}
other => other?,
} Prevention
- Copy hashes from the rendered todo script instead of typing them.
- Use full hashes when hand-editing to avoid ambiguity.
- Only reference commits shown in the divergence display.
- Re-run the parser after each edit to fail fast at the offending line.
When it happens
Trigger: parse_integration_steps_script encountering a line 'pick <commit>' where the commit argument fails resolve_commit: unknown commit, too-short/ambiguous short hash, hash not among allowed candidate commits, or a typo introduced while editing the todo script in the editor.
Common situations: Hand-editing the integration todo file and mistyping a hash; using a short hash that matches nothing or multiple candidate commits; referencing a commit not part of the upstream divergence being integrated; copying lines between different integration sessions.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- line : invalid merge commit
- line : invalid squash commit
- commit ' ' is not part of the editable divergence
- Integration steps cannot be empty
- line : invalid squash message
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/cfc9100d8e01fae2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:56
continue;
};
let arguments = tokens.get(1..).unwrap_or_default();
let step = match command {
"pick" => {
if message_part.is_some() {
bail!("line {line_number}: pick does not accept a message clause");
}
if arguments.len() != 1 {
bail!("line {line_number}: pick requires exactly one commit");
}
let commit = arguments
.first()
.copied()
.expect("validated pick arity above");
InteractiveIntegrationStep::Pick {
commit_id: resolve_commit(commit, &allowed_commits).map_err(|err| {
anyhow::anyhow!("line {line_number}: invalid pick commit: {err}")
})?,
}
}
"merge" => {
if message_part.is_some() {
bail!("line {line_number}: merge does not accept a message clause");
}
if arguments.len() != 1 {
bail!("line {line_number}: merge requires exactly one commit");
}
let commit = arguments
.first()
.copied()
.expect("validated merge arity above");
InteractiveIntegrationStep::Merge {
commit_id: resolve_commit(commit, &allowed_commits).map_err(|err| {
anyhow::anyhow!("line {line_number}: invalid merge commit: {err}")
})?,View on GitHub (pinned to 58e5313667)