GitoxideLabs/gitoxide · error

an edit unexpectedly produced a merge conflict

Error message

an edit unexpectedly produced a merge conflict

What it means

`Perform::complete` converts an internal rebase result into an `Outcome`. A conflict result is normally handled and resolved interactively during the rebase; if a `Perform::Conflict` still exists when the edit is declared complete, the rebase machinery reached an unexpected state. This is an internal invariant check — the conflict should never have survived to this point.

Solutions

  1. Inspect the repository state (`git status`) for leftover conflict markers and resolve or abort the in-progress rebase before retrying.
  2. Retry the edit after resolving conflicting changes manually, or split the edit into smaller steps that avoid conflicts.
  3. If reproducible without a real conflict, report it as a bug in tix's rebase conflict handling (invariant violation).
Defensive patterns

Strategy: try-catch

Validate before calling

// Rust: only call complete() when no conflict remains
if matches!(performed, Perform::Conflict(_)) {
    handle_conflict_interactively(performed)?;
} else {
    let outcome = performed.complete()?;
}

Type guard

fn is_ready(performed: &Perform) -> bool {
    matches!(performed, Perform::Complete(_))
}

Try / catch

// Rust
let outcome = performed.complete().map_err(|e| {
    eprintln!("conflict left after edit; resolve manually with git status");
    e
})?;

Prevention

When it happens

Trigger: Finishing a tix edit/rebase whose `Perform` state is `Perform::Conflict(_)` at `complete()` time, i.e. the rebase stopped on a merge conflict that the caller of `complete()` did not surface or resolve beforehand.

Common situations: Rebasing edits across a history that touches the same paths in diverging branches and produces a conflict mid-rebase while the driver assumes conflict-free edits; a bug or unhandled conflict path in the edit workflow.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/9b9f248139408a04. Report an issue: GitHub.

Appendix: source

Thrown at gix-tix/src/edit/rebase.rs:294

    pub new: ObjectId,
}

impl Outcome {
    pub(crate) fn map(&self, id: ObjectId) -> Option<ObjectId> {
        self.rewritten.get(&id).copied().unwrap_or(Some(id))
    }
}

pub(crate) enum Perform {
    Complete(Outcome),
    Conflict(Conflict),
}

impl Perform {
    pub(crate) fn complete(self) -> Result<Outcome> {
        match self {
            Perform::Complete(outcome) => Ok(outcome),
            Perform::Conflict(_) => anyhow::bail!("an edit unexpectedly produced a merge conflict"),
        }
    }
}

pub(crate) struct Conflict {
    prepared: Prepared,
    conflicts: Vec<gix::merge::tree::Conflict>,
    merged_tree: ObjectId,
    commit: ObjectId,
    original: ObjectId,
}

impl Conflict {
    pub(crate) fn original(&self) -> ObjectId {
        self.original
    }

    pub(crate) fn persist(mut self) -> Result<PersistedConflict> {

View on GitHub (pinned to e73179060b)