affaan-m/ECC · error · anyhow::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

Like `worktree-status`, the `worktree-resolution` subcommand treats `--all` and an explicit session ID as mutually exclusive. Supplying both is ambiguous, so the command validates inputs first and returns this error before querying anything.

Solutions

  1. Drop the session ID argument when using `--all`.
  2. Drop `--all` and pass exactly one session ID for a single-session report.
  3. Fix wrapper scripts to choose one mode based on whether an ID was supplied.
  4. Check `ecc2 worktree-resolution --help` for the accepted usage.

Example fix

// before (shell)
ecc2 worktree-resolution --all sess-42

// after
ecc2 worktree-resolution --all      # all sessions
ecc2 worktree-resolution sess-42    # one session
Defensive patterns

Strategy: validation

Validate before calling

// shell: guard against combining --all with a session ID
if $ALL_MODE && [ -n "$SESSION_ID" ]; then echo "--all excludes a session ID"; exit 1; fi

Type guard

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

Try / catch

// surface the validation error cleanly in wrappers
if ! ecc2 worktree-resolution "$@"; then echo "invalid worktree-resolution arguments" >&2; exit 1; fi

Prevention

When it happens

Trigger: Running `ecc2 worktree-resolution --all <session-id>` — `all && session_id.is_some()`.

Common situations: Copy-pasting an example that included both forms; scripts that append a session ID while CI config enables `--all`; assuming the ID would narrow the `--all` scope.

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/cd570442be869a51. Report an issue: GitHub.

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