affaan-m/ECC · error · anyhow::Error
merge-worktree does not accept a session ID when --all is…
Error message
merge-worktree does not accept a session ID when --all is set
What it means
The `merge-worktree` subcommand accepts either `--all` (merge every ready worktree) or a single session ID, but not both. Supplying both fails this up-front validation, since the merge target must be unambiguous.
Solutions
- Use `--all` alone to merge all ready worktrees.
- Use the session ID alone to merge just that session's worktree.
- Adjust wrapper scripts to conditionally pass one or the other.
- Verify usage with `ecc2 merge-worktree --help`.
Example fix
// before (shell) ecc2 merge-worktree --all sess-42 // after ecc2 merge-worktree --all # merge all ready worktrees ecc2 merge-worktree sess-42 # merge one
Defensive patterns
Strategy: validation
Validate before calling
// shell: pick one merge scope if $ALL_MODE && [ -n "$SESSION_ID" ]; then echo "use --all or a session ID, not both"; exit 1; fi
Type guard
fn merge_args_ok(all: bool, session_id: &Option<String>) -> bool {
!(all && session_id.is_some())
} Try / catch
// wrap merge calls with explicit failure handling if ! ecc2 merge-worktree "$@"; then echo "merge-worktree argument error" >&2; exit 1; fi
Prevention
- Explicitly choose bulk vs. single-session merge in scripts.
- Never hardcode --all in shared aliases or wrappers.
- Check `--help` output when upgrading ecc2, as flag semantics may tighten.
- Review generated command lines in CI for both flag and ID.
When it happens
Trigger: Running `ecc2 merge-worktree --all <session-id>` (or `-s <id>` together with `--all`).
Common situations: Scripted invocations that hardcode `--all` while also forwarding a positional/flagged session argument; shell completions or docs mixing the two usage forms.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- git status failed
- git worktree add failed
- worktree-resolution does not accept a session ID when --all…
- worktree-status does not accept a session ID when --all is…
- Base branch is not checked out in repo root (currently )
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/2cc50a286fc5e7bf.
Report an issue: GitHub.
Appendix: source
Thrown at ecc2/src/main.rs:2072
println!("{}", serde_json::to_string_pretty(&reports)?);
} else {
println!("{}", serde_json::to_string_pretty(&reports[0])?);
}
} else {
println!("{}", format_worktree_resolution_reports_human(&reports));
}
if check {
std::process::exit(worktree_resolution_reports_exit_code(&reports));
}
}
Some(Commands::MergeWorktree {
session_id,
all,
json,
keep_worktree,
}) => {
if all && session_id.is_some() {
return Err(anyhow::anyhow!(
"merge-worktree does not accept a session ID when --all is set"
));
}
if all {
let outcome = session::manager::merge_ready_worktrees(&db, !keep_worktree).await?;
if json {
println!("{}", serde_json::to_string_pretty(&outcome)?);
} else {
println!("{}", format_bulk_worktree_merge_human(&outcome));
}
} else {
let id = session_id.unwrap_or_else(|| "latest".to_string());
let resolved_id = resolve_session_id(&db, &id)?;
let outcome =
session::manager::merge_session_worktree(&db, &resolved_id, !keep_worktree)
.await?;
if json {
println!("{}", serde_json::to_string_pretty(&outcome)?);View on GitHub (pinned to 8321021c54)