affaan-m/ECC · error · anyhow::Error

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

Error message

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

What it means

The `worktree-status` subcommand supports either an aggregate report for all sessions (`--all`) or a per-session report for one session ID. These are mutually exclusive; passing both makes the request ambiguous, so the command rejects it up front with this validation error.

Solutions

  1. Remove the session ID argument and keep `--all` for an aggregate report.
  2. Remove `--all` and keep the single session ID for a per-session report.
  3. Update any scripts/aliases to pass either the flag or the ID, never both.
  4. Use `--help` on the subcommand to confirm the accepted argument forms.

Example fix

// before (shell)
ecc2 worktree-status --all mysession-id

// after
ecc2 worktree-status --all        # every session
ecc2 worktree-status mysession-id # one session
Defensive patterns

Strategy: validation

Validate before calling

// shell: enforce one mode before invoking
[ -n "$SESSION_ID" ] && $ALL_MODE && { echo "pass either --all or a session ID, not both"; exit 1; }

Type guard

fn worktree_status_args_ok(all: bool, session_id: &Option<String>) -> bool {
    !(all && session_id.is_some())
}

Try / catch

// in scripts, capture and surface the CLI's validation error
ecc2 worktree-status "$@" || { echo "worktree-status argument error"; exit 1; }

Prevention

When it happens

Trigger: Running `ecc2 worktree-status --all <session-id>` (or with `-s <id>`) — i.e. `all && session_id.is_some()`.

Common situations: Scripting the command with a saved session ID plus a `--all` flag added later; shell aliases that always append a session argument; misunderstanding that `--all` scopes rather than replaces the ID argument.

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


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/f71bf3a7e57e286d. Report an issue: GitHub.

Appendix: 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 8321021c54)