GitoxideLabs/gitoxide · error
cannot create a commit with unresolved index conflicts
Error message
cannot create a commit with unresolved index conflicts
What it means
The Git index still contains entries from an unresolved merge conflict (entries at stages other than Unconflicted). tix refuses to build a tree or create a commit from such an index, because committing conflicted index state would produce a broken commit. The conflict must be resolved and staged first.
Solutions
- Resolve the conflicts in the worktree and stage the resolved files (`git add <paths>` or `tix` staging equivalent), then retry.
- Abort the in-progress merge/rebase (`git merge --abort` / `git rebase --abort`) and redo the operation on a clean state.
- Check `git status` for unmerged paths before running the command.
Example fix
// guard before calling
let index = repo.index_or_empty()?;
if index.entries().iter().any(|e| e.stage() != gix::index::entry::Stage::Unconflicted) {
anyhow::bail!("resolve conflicts before editing");
}
create::prepare(&repo, Some(head_id), ...)?; Defensive patterns
Strategy: validation
Validate before calling
let index = repo.index_or_empty()?;
let conflicted = index.entries().iter()
.any(|e| e.stage() != gix::index::entry::Stage::Unconflicted);
if conflicted {
anyhow::bail!("resolve and stage all conflicts before committing");
} Try / catch
match result {
Err(e) if e.to_string().contains("unresolved index conflicts") => {
eprintln!("run: git status # resolve Unmerged paths, then retry");
}
other => other?,
} Prevention
- Check `git status` for 'Unmerged paths' before any commit-producing tix command.
- Always `git add` resolved files after a conflict.
- Ensure merges/rebases are completed or aborted before running edit operations.
When it happens
Trigger: Calling `prepare`/`prepare_empty`/`prepare_from` (via `prepare_inner`) when `repo.index_or_empty()` contains any entry whose `stage() != Stage::Unconflicted`, i.e. mid-merge/rebase/cherry-pick with conflicts unresolved.
Common situations: Attempting `tix edit`/create during an interrupted merge or rebase; a previous `git merge` left conflicts and the user forgot to `git add` resolved files; automation resuming operations after a conflict abort.
Related errors
- cannot spill an unmerged path
- could not apply conflict stages to the prepared index
- cannot time-travel with unresolved index conflicts
- the conflict index still has unresolved entries
- invalid mode change: can't flip executable bit of
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/93acc9af04fcea15.
Report an issue: GitHub.
Appendix: source
Thrown at gix-tix/src/edit/create.rs:108
.context("could not resolve commit signing configuration")?;
repo = repo.with_object_memory();
let baseline = match parent {
Some(id) => repo
.find_commit(id)
.context("could not find the parent commit")?
.tree()
.context("could not load the parent tree")?,
None => repo.empty_tree(),
};
let baseline_id = baseline.id;
let index = repo.index_or_empty().context("could not load the index")?;
if index
.entries()
.iter()
.any(|entry| entry.stage() != gix::index::entry::Stage::Unconflicted)
{
anyhow::bail!("cannot create a commit with unresolved index conflicts");
}
let index_tree = index_tree(&repo, &index)?;
let based_on_parent = head_id == parent;
let tree = if empty || !based_on_parent {
baseline.id
} else {
match source {
Source::Default if index_tree != baseline.id => index_tree,
Source::Default | Source::Worktree => worktree_tree_tracked(&repo, &baseline, &index)?,
Source::Index => index_tree,
Source::WorktreeUntracked => worktree_tree(&repo, &baseline)?,
}
};
let new_tree = repo.find_tree(tree).context("could not load the candidate tree")?;
let mut changes = load_tree_changes_without_lines(
&repo,
parent.map(|_| &baseline),View on GitHub (pinned to e73179060b)