{"record":{"id":"72b2d380a7eef885","repo":"gitbutlerapp/gitbutler","slug":"commit-spec-is-not-part-of-the-editable-diverg","errorCode":null,"errorMessage":"commit '{spec}' is not part of the editable divergence","messagePattern":"commit '(.+?)' is not part of the editable divergence","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":159,"sourceCode":"        .filter(|commit| {\n            matches!(\n                commit.target_relation,\n                IntegrationDivergenceTargetRelation::NotIntegrated\n            )\n        })\n        .map(|commit| commit.id)\n        .chain(divergence.upstream_only.iter().map(|commit| commit.id))\n        .collect()\n}\n\nfn resolve_commit(spec: &str, allowed_commits: &HashSet<gix::ObjectId>) -> Result<gix::ObjectId> {\n    let matches = allowed_commits\n        .iter()\n        .copied()\n        .filter(|commit_id| commit_id.to_string().starts_with(spec))\n        .collect::<Vec<_>>();\n    match matches.as_slice() {\n        [] => bail!(\"commit '{spec}' is not part of the editable divergence\"),\n        [commit_id] => Ok(*commit_id),\n        _ => bail!(\"commit prefix '{spec}' is ambiguous\"),\n    }\n}\n\nfn split_message_clause(line: &str) -> Result<(&str, Option<&str>)> {\n    let Some((command_part, message_part)) = line.split_once('|') else {\n        return Ok((line, None));\n    };\n    Ok((command_part.trim_end(), Some(message_part.trim_start())))\n}\n\nfn parse_message_clause(clause: &str) -> Result<String> {\n    let value = clause\n        .strip_prefix(\"message=\")\n        .context(\"expected `message=` after `|`\")?;\n    parse_quoted_string(value)\n}","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L141-L177","documentation":"`resolve_commit` validates that every commit hash referenced in the script belongs to the set of editable commits derived from the integration divergence: local-only commits that are `NotIntegrated`, plus all upstream-only commits. This error is raised when no allowed commit's hex string starts with the given spec — the commit either does not exist, was already integrated, or the hash was mistyped. It surfaces wrapped as `line N: invalid pick/merge/squash commit: ...`.","triggerScenarios":"Calling parse_integration_steps_script with a hash that matches no editable divergence commit: a nonexistent hash, a commit from another branch, a historically-integrated local commit (e.g. `pick 1111111` in the test fixture), or a full hash of a commit outside the divergence.","commonSituations":"The user copies a hash from `git log` of a different branch or from an older divergence listing after new commits changed the picture; or references a local commit that the target relation marks as already integrated and therefore not editable.","solutions":["Check the hash against the divergence listing shown in the UI; only listed commits are editable.","Correct typos in the hash — specs are matched as hex string prefixes, so any wrong character makes it unresolvable.","If the commit is a historically-integrated local commit, it cannot be picked; work with its upstream counterpart instead.","Re-fetch the divergence (refresh the integration view) if the branch changed since the script was rendered, then update hashes."],"exampleFix":"// before (script text — 9999999 is not in the divergence)\npick 9999999\n// after\npick 3333333\n","handlingStrategy":"validation","validationCode":"function validateCommitsExist(script: string, allowedShortIds: string[]): string[] {\n  const cmds = script.split('\\n').filter(l => /^(pick|merge|squash)\\b/.test(l.trim()));\n  return cmds.flatMap((line, i) => {\n    const [cmd, ...args] = line.split('|')[0].trim().split(/\\s+/).filter(Boolean);\n    return args.filter(a => !allowedShortIds.some(id => id.startsWith(a)))\n      .map(a => `line ${i + 1}: commit '${a}' is not part of the editable divergence`);\n  });\n}","typeGuard":"const commitIsEditable = (spec: string, allowedShortIds: string[]): boolean =>\n  allowedShortIds.some(id => id.startsWith(spec));","tryCatchPattern":"try {\n  const steps = await parseIntegrationScript(script, divergence);\n} catch (err) {\n  const m = /line (\\d+): invalid \\w+ commit: commit '([^']+)' is not part/.exec(String(err));\n  if (m) showEditorErrorAtLine(Number(m[1]), `commit ${m[2]} is not editable; pick from the divergence list`);\n  else throw err;\n}","preventionTips":["Copy hashes only from the divergence listing rendered next to the script.","Do not reuse scripts after the branch diverged further — refresh and re-render first.","Remember historically-integrated local commits are excluded from the editable set."],"tags":["parsing","git","commit-resolution","validation"],"backgroundTag":"entity-not-found","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"}