affaan-m/ECC · error

worktree-resolution does not accept a session ID when --all

Error message

worktree-resolution does not accept a session ID when --all is set

What it means

Argument-conflict error from the WorktreeResolution command handler in ecc2/src/main.rs. When --all is set together with a session_id, the handler bails: "worktree-resolution does not accept a session ID when --all is set". --all means 'resolve across every conflicted session', so naming one session is contradictory.

Source

Thrown at ecc2/src/main.rs:2032

                    println!("{}", serde_json::to_string_pretty(&reports)?);
                } else {
                    println!("{}", serde_json::to_string_pretty(&reports[0])?);
                }
            } else {
                println!("{}", format_worktree_status_reports_human(&reports));
            }
            if check {
                std::process::exit(worktree_status_reports_exit_code(&reports));
            }
        }
        Some(Commands::WorktreeResolution {
            session_id,
            all,
            json,
            check,
        }) => {
            if all && session_id.is_some() {
                return Err(anyhow::anyhow!(
                    "worktree-resolution does not accept a session ID when --all is set"
                ));
            }
            let reports = if all {
                session::manager::list_sessions(&db)?
                    .into_iter()
                    .map(|session| build_worktree_resolution_report(&session))
                    .collect::<Result<Vec<_>>>()?
                    .into_iter()
                    .filter(|report| report.conflicted)
                    .collect::<Vec<_>>()
            } else {
                let id = session_id.unwrap_or_else(|| "latest".to_string());
                let resolved_id = resolve_session_id(&db, &id)?;
                let session = db
                    .get_session(&resolved_id)?
                    .ok_or_else(|| anyhow::anyhow!("Session not found: {resolved_id}"))?;
                vec![build_worktree_resolution_report(&session)?]

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Drop either --all or the session id.
  2. Check --help for the mutual exclusivity of --all and the positional id.
  3. Fix any wrapper script that always appends an id.

Example fix

# before
$ ecc worktree-resolution --all abc123

# after (pick one)
$ ecc worktree-resolution --all
$ ecc worktree-resolution 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

let reports = if all {
    if session_id.is_some() {
        eprintln!("ignoring session id because --all was set");
    }
    // ...build all-session reports
} else {
    // ...build single-session report
};

Prevention

When it happens

Trigger: Running `worktree-resolution --all <session_id>` such that both `all` is true and `session_id` is Some.

Common situations: User assumed --all plus an id scopes the operation; a wrapper script appends an id unconditionally; copy-paste from a previous single-session invocation.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/cd570442be869a51. Report an issue: GitHub.