affaan-m/ECC · error

worktree-status does not accept a session ID when --all is s

Error message

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

What it means

Argument-conflict error from the WorktreeStatus command handler in ecc2/src/main.rs. When the user passes --all together with a session_id, the handler immediately bails: "worktree-status does not accept a session ID when --all is set". --all means 'report on every session', so singling out one session is contradictory.

Source

Thrown at ecc2/src/main.rs:1995

            let id = session_id.unwrap_or_else(|| "latest".to_string());
            let status = session::manager::get_status(&db, &cfg, &id)?;
            println!("{status}");
        }
        Some(Commands::Team { session_id, depth }) => {
            sync_runtime_session_metrics(&db, &cfg)?;
            let id = session_id.unwrap_or_else(|| "latest".to_string());
            let team = session::manager::get_team_status(&db, &id, depth)?;
            println!("{team}");
        }
        Some(Commands::WorktreeStatus {
            session_id,
            all,
            json,
            patch,
            check,
        }) => {
            if all && session_id.is_some() {
                return Err(anyhow::anyhow!(
                    "worktree-status 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_status_report(&session, patch))
                    .collect::<Result<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_status_report(&session, patch)?]
            };
            if json {
                if all {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Drop either --all or the session id, depending on whether you want all sessions or one.
  2. Run with --help to confirm the mutual-exclusivity of --all and the positional id.
  3. If a wrapper script always appends an id, fix the script.

Example fix

# before
$ ecc worktree-status --all abc123

# after (pick one)
$ ecc worktree-status --all
$ ecc worktree-status abc123
Defensive patterns

Strategy: validation

Validate before calling

// Reject the conflict at parse time before reaching the handler.
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-status --all <session_id>` (or the equivalent long form) such that both `all` is true and `session_id` is Some.

Common situations: User misread the help and assumed --all plus an id filters; a shell alias or wrapper script appends an id unconditionally; copy-paste of a previous command that included an id.

Related errors


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