nikivdev/code · error

Merge conflicts with {}. Run `:sync repair --packet {}` or r

Error message

Merge conflicts with {}.
Run `:sync repair --packet {}` or resolve manually:
  git status
  # fix conflicts
  git add . && git commit

What it means

Raised in src/sync.rs after the sync repair routing reported SyncRepairRouteOutcome::Unresolved and a repair packet path was available. It means merge conflicts with the remote ref could not be resolved automatically, so the library bails with instructions to either run the packet-based repair or resolve the conflicts manually with git. This is the packet-assisted variant of the unresolved-conflict failure.

Source

Thrown at src/sync.rs:4161

                sync_progressln!("Sync agent resolved the sync repair flow");
                recorder.record(stage, "sync agent resolved merge conflicts");
                return Ok(());
            }
            SyncRepairRouteOutcome::ValidationPending => {
                recorder.record(stage, "merge validation pending after sync agent repair");
                bail!(
                    "Sync agent cleared raw conflicts for {} but validation and merge finalization are still pending.\nRun `:sync repair --packet {}` or validate and finish the merge manually.",
                    remote_ref,
                    packet_path.display()
                );
            }
            SyncRepairRouteOutcome::Unresolved => {}
        }
    }

    recorder.record(stage, "merge conflicts unresolved");
    if let Some(packet_path) = repair_packet_path {
        bail!(
            "Merge conflicts with {}.\nRun `:sync repair --packet {}` or resolve manually:\n  git status\n  # fix conflicts\n  git add . && git commit",
            remote_ref,
            packet_path.display()
        );
    }
    bail!(
        "Merge conflicts with {}. Resolve manually:\n  git status\n  # fix conflicts\n  git add . && git commit",
        remote_ref
    );
}

fn origin_default_branch_for_feature_sync(
    repo_root: &Path,
    current_branch: &str,
) -> Option<String> {
    let current = current_branch.trim();
    if current.is_empty() || current == "HEAD" {
        return None;

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `:sync repair --packet <packet_path>` from the message to trigger guided conflict repair
  2. Resolve manually: run `git status`, fix conflicted files, then `git add . && git commit`
  3. Re-run the sync command after conflicts are committed
  4. Compare local vs remote (`git log --oneline <remote_ref>..HEAD` and vice versa) to understand divergence before re-syncing

Example fix

// before: conflicted working tree
<<<<<<< HEAD
let x = 1;
=======
let x = 2;
>>>>>>> origin/main
// after: pick the correct resolution, then
$ git add . && git commit
Defensive patterns

Strategy: try-catch

Validate before calling

// detect divergence before syncing
let out = std::process::Command::new("git").args(["rev-list", "--left-right", "--count", "HEAD...origin/main"]).output()?;
let counts: Vec<&str> = String::from_utf8_lossy(&out.stdout).split_whitespace().collect();
if counts.iter().any(|c| c != "0") {
    eprintln!("Branches diverged; expect conflicts; keep the repair packet path handy");
}

Try / catch

match sync_result {
    Err(e) if e.to_string().contains("Merge conflicts with") => {
        eprintln!("{e}"); // message includes `:sync repair --packet` instructions
    }
    other => other?,
}

Prevention

When it happens

Trigger: A sync/merge against remote_ref produced conflicts, the sync-agent repair route ended in `Unresolved`, and `repair_packet_path` is Some — i.e. a repair packet exists for automated retry.

Common situations: Divergent local and remote branches with overlapping edits; a prior agent repair pass failed; CI-less local syncs where auto-resolution tooling cannot decide a resolution.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/40cace4adf47fdb1. Report an issue: GitHub.