affaan-m/ECC · error
merge-worktree does not accept a session ID when --all is se
Error message
merge-worktree does not accept a session ID when --all is set
What it means
Argument-conflict error from the MergeWorktree command handler in ecc2/src/main.rs. When --all is set together with a session_id, the handler bails: "merge-worktree does not accept a session ID when --all is set". The --all branch calls merge_ready_worktrees across every session, so naming one session is contradictory.
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 01e15490f0)
Solutions
- Drop either --all or the session id.
- Check --help for the mutual exclusivity.
- Fix any wrapper script that unconditionally appends an id.
Example fix
# before $ ecc merge-worktree --all abc123 # after (pick one) $ ecc merge-worktree --all $ ecc merge-worktree abc123
Defensive patterns
Strategy: validation
Validate before calling
if all && session_id.is_some() {
eprintln!("--all cannot be combined with a session id");
return Ok(());
} Type guard
fn args_consistent(all: bool, session_id: &Option<String>) -> bool {
!(all && session_id.is_some())
} Try / catch
if all {
if session_id.is_some() {
eprintln!("ignoring session id because --all was set");
}
let outcome = session::manager::merge_ready_worktrees(&db, !keep_worktree).await?;
// ...
} else {
// single-session merge
} Prevention
- Read --help to learn which flags are mutually exclusive.
- Use clap's `conflicts_with` to enforce mutual exclusivity at parse time.
- Audit wrapper scripts that append positional args unconditionally.
- Prefer explicit --all or an explicit id, never both.
When it happens
Trigger: Running `merge-worktree --all <session_id>` such that both `all` is true and `session_id` is Some.
Common situations: User assumed --all plus an id scopes the merge; a wrapper script always appends an id; copy-paste from a single-session invocation.
Related errors
- worktree-status does not accept a session ID when --all is s
- worktree-resolution does not accept a session ID when --all
- Session not found: {resolved_id}
- Unknown flag: {arg}
- {label} must be a regular file
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/2cc50a286fc5e7bf.
Report an issue: GitHub.