affaan-m/ECC · error · anyhow::Error
readiness.summary
Error message
readiness.summary
What it means
merge_into_base first calls merge_readiness; if the worktree branch is Conflicted, it aborts the merge with the readiness summary as the error message. The summary lists the conflicting files, so this error is the library's way of refusing to perform a merge that git would reject mid-flight.
Solutions
- Read readiness.summary to see which files conflict.
- Rebase the worktree branch onto the updated base: `git rebase <base_branch>` in the worktree.
- Resolve conflicts, then retry merge_into_base.
- Alternatively merge base into the branch first to resolve conflicts locally.
- Call merge_readiness yourself before merging to present conflicts to the user instead of failing.
Example fix
// before merge_into_base(&wt)?; // fails when conflicted // after let readiness = merge_readiness(&wt)?; anyhow::ensure!(readiness.status != MergeReadinessStatus::Conflicted, "resolve conflicts first"); merge_into_base(&wt)?;
Defensive patterns
Strategy: validation
Validate before calling
let readiness = merge_readiness(&wt)?;
if readiness.status == MergeReadinessStatus::Conflicted {
eprintln!("conflicts: {}", readiness.summary);
return Ok(()); // or prompt the user
} Try / catch
if let Err(e) = merge_into_base(&wt) {
eprintln!("merge blocked: {e}"); // message is the conflict summary — show it to the user
} Prevention
- Check merge_readiness before every merge_into_base call
- Rebase branches onto base frequently to avoid drift
- Surface readiness.summary in UI instead of attempting the merge
- Keep branches short-lived
When it happens
Trigger: Calling merge_into_base for a worktree whose changes overlap with changes already on the base branch — merge_readiness detected staged conflict entries via merge-tree.
Common situations: Two worktrees edited the same lines; base branch advanced (e.g. after another feature merged) and now conflicts with this branch; long-lived branch that was never rebased.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- git merge failed
- git merge-tree failed
- git rebase failed
- Base branch is not checked out in repo root (currently )
- branch name is not a valid git ref
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/ab54983124ee3432.
Report an issue: GitHub.
Appendix: source
Thrown at ecc2/src/worktree/mod.rs:861
} else {
Ok(WorktreeHealth::InProgress)
}
}
pub fn has_uncommitted_changes(worktree: &WorktreeInfo) -> Result<bool> {
Ok(!git_status_short(&worktree.path)?.is_empty())
}
pub fn has_staged_changes(worktree: &WorktreeInfo) -> Result<bool> {
Ok(git_status_entries(worktree)?
.iter()
.any(|entry| entry.staged))
}
pub fn merge_into_base(worktree: &WorktreeInfo) -> Result<MergeOutcome> {
let readiness = merge_readiness(worktree)?;
if readiness.status == MergeReadinessStatus::Conflicted {
anyhow::bail!(readiness.summary);
}
if has_uncommitted_changes(worktree)? {
anyhow::bail!(
"Worktree {} has uncommitted changes; commit or discard them before merging",
worktree.branch
);
}
let repo_root = base_checkout_path(worktree)?;
let current_branch = get_current_branch(&repo_root)?;
if current_branch != worktree.base_branch {
anyhow::bail!(
"Base branch {} is not checked out in repo root (currently {})",
worktree.base_branch,
current_branch
);
}View on GitHub (pinned to 8321021c54)