{"record":{"id":"a711a4bcb30b18aa","repo":"can1357/oh-my-pi","slug":"merge-conflict-in-file-s","errorCode":null,"errorMessage":"merge conflict in {} file(s)","messagePattern":"merge conflict in (.+?) file\\(s\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/pi-vcs/src/error.rs","lineNumber":49,"sourceCode":"\t#[error(\"object not found: {spec}\")]\n\tObjectNotFound {\n\t\t/// The revision or object spec as given by the caller.\n\t\tspec: String,\n\t},\n\n\t/// Cherry-picking `sha` produced an empty commit (already applied or\n\t/// auto-resolved to HEAD). Callers should skip and continue the range —\n\t/// replaces the historical `/the previous cherry-pick is now empty/` stderr\n\t/// regex.\n\t#[error(\"cherry-pick of {sha} is empty\")]\n\tEmptyCherryPick {\n\t\t/// The commit that collapsed to a no-op.\n\t\tsha: String,\n\t},\n\n\t/// A merge-style operation (cherry-pick, stash pop, 3-way apply) hit\n\t/// conflicting changes.\n\t#[error(\"merge conflict in {} file(s)\", paths.len())]\n\tConflict {\n\t\t/// Worktree-relative paths left in a conflicted state.\n\t\tpaths: Vec<String>,\n\t},\n\n\t/// A patch did not apply (context mismatch, missing file, malformed input).\n\t#[error(\"patch does not apply: {message}\")]\n\tPatchFailed {\n\t\t/// Human-readable reason, including the offending path when known.\n\t\tmessage: String,\n\t},\n\n\t/// A CLI-backed operation (push/fetch/clone, reftable fallback) exited\n\t/// non-zero. Carries the captured streams for user-facing error surfaces.\n\t#[error(\"{}\", crate::error::cli_message(command, *exit_code, stdout, stderr))]\n\tCli {\n\t\t/// Rendered command line (`git push --no-follow-tags …`).\n\t\tcommand:   String,","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-vcs/src/error.rs#L31-L67","documentation":"Error::Conflict is raised when a merge-style operation (cherry-pick, stash pop, 3-way apply) hits conflicting changes. The error carries the list of worktree-relative paths left in a conflicted state so callers can present resolution UI or abort programmatically.","triggerScenarios":"Cherry-pick/stash-pop/apply where the incoming change touches lines overlapping different content already in HEAD: e.g. applying a patch built against an old base, popping a stash onto a rebased branch, picking a commit into a heavily diverged branch.","commonSituations":"Long-lived branches diverging from main, stashes created before a rebase, automated backports after the file was refactored, parallel edits to the same lines by two developers.","solutions":["Inspect each path in `paths`, resolve conflict markers by hand (or a merge tool), then `git add` the files and continue the operation.","Abort cleanly if unresolvable: `git cherry-pick --abort` / `git merge --abort` (or the library's abort API) to restore pre-operation state.","Rebase the target branch onto its base first to reduce divergence, then retry the operation.","Use a 3-way apply with a better base ref if the patch context drifted only slightly."],"exampleFix":"// before\nrepo.cherry_pick(\"abc123\")?; // surfaces raw conflict\n// after\nmatch repo.cherry_pick(\"abc123\") {\n    Err(Error::Conflict { paths, .. }) => {\n        eprintln!(\"resolve these files first: {paths:?}\");\n        repo.abort_cherry_pick()?;\n    }\n    Err(e) => return Err(e),\n    Ok(()) => {}\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_conflict(err: &pi_vcs::Error) -> Option<&[String]> {\n    match err {\n        pi_vcs::Error::Conflict { paths } => Some(paths),\n        _ => None,\n    }\n}","tryCatchPattern":"match repo.cherry_pick(sha) {\n    Err(pi_vcs::Error::Conflict { paths, .. }) => {\n        for p in &paths { eprintln!(\"conflict marker cleanup needed in {p}\"); }\n        repo.abort_cherry_pick()?; // restore pre-operation state\n    }\n    other => other?,\n}","preventionTips":["Rebase the target branch onto the base before merge-style operations to minimize divergence.","Keep stashes short-lived; pop them right after creation or drop them after a rebase.","Regenerate patches from a recent base rather than reusing old diff files.","Always provide an abort/cleanup path when invoking operations that can conflict."],"tags":["vcs","git","merge-conflict","cherry-pick"],"backgroundTag":"merge-conflict","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}