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

decisions does not accept a session ID when --all is set

Error message

decisions does not accept a session ID when --all is set

What it means

The `decisions` subcommand lists decision log entries either across all sessions (`--all`, using `db.list_decisions`) or scoped to one session. Passing `--all` together with a session ID is rejected at parse/validation time with this error.

Solutions

  1. Remove the session ID and keep `--all` to list decisions across sessions.
  2. Remove `--all` and pass only the session ID to list that session's decisions.
  3. Update scripts so the mode is chosen by presence/absence of the ID.
  4. Consult `ecc2 decisions --help` for the two accepted forms.

Example fix

// before (shell)
ecc2 decisions --all sess-42

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

Strategy: validation

Validate before calling

// shell: enforce exclusivity before listing decisions
if $ALL_MODE && [ -n "$SESSION_ID" ]; then echo "--all and a session ID are mutually exclusive"; exit 1; fi

Type guard

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

Try / catch

// catch validation failure at the script boundary
ecc2 decisions "$@" || { echo "decisions: bad argument combination" >&2; exit 1; }

Prevention

When it happens

Trigger: Running `ecc2 decisions --all <session-id>` where `all && session_id.is_some()`.

Common situations: Adding `--all` to an existing per-session query to 'widen' it; automation templates that always include a session ID; misunderstanding the flag's semantics.

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

Appendix: source

Thrown at ecc2/src/main.rs:2143

            alternatives,
            json,
        }) => {
            let resolved_id = resolve_session_id(&db, session_id.as_deref().unwrap_or("latest"))?;
            let entry = db.insert_decision(&resolved_id, &decision, &alternatives, &reasoning)?;
            if json {
                println!("{}", serde_json::to_string_pretty(&entry)?);
            } else {
                println!("{}", format_logged_decision_human(&entry));
            }
        }
        Some(Commands::Decisions {
            session_id,
            all,
            json,
            limit,
        }) => {
            if all && session_id.is_some() {
                return Err(anyhow::anyhow!(
                    "decisions does not accept a session ID when --all is set"
                ));
            }
            let entries = if all {
                db.list_decisions(limit)?
            } else {
                let resolved_id =
                    resolve_session_id(&db, session_id.as_deref().unwrap_or("latest"))?;
                db.list_decisions_for_session(&resolved_id, limit)?
            };
            if json {
                println!("{}", serde_json::to_string_pretty(&entries)?);
            } else {
                println!("{}", format_decisions_human(&entries, all));
            }
        }
        Some(Commands::Migrate { command }) => match command {
            MigrationCommands::Audit { source, json } => {

View on GitHub (pinned to 8321021c54)