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

Thrown by the `decisions` CLI subcommand when the caller passes both the `--all` flag and a positional/named session ID. The command logic is exclusive: `--all` lists decisions across every session, while a session ID scopes to one session, so supplying both is an invalid combination that the argument parser cannot disambiguate. The guard fires before any database access, so it is a pure usage error.

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 01e15490f0)

Solutions

  1. Drop the session ID argument when using `--all`: run `ecc decisions --all`.
  2. If you want a single session, remove `--all`: run `ecc decisions <session-id>` (or `ecc decisions` for latest).
  3. Audit shell aliases / wrapper scripts to ensure `session_id` and `all` are mutually exclusive before invoking the CLI.

Example fix

// before
ecc decisions --all latest

// after
ecc decisions --all
Defensive patterns

Strategy: validation

Validate before calling

// Validate before constructing the command
fn decisions_args_valid(all: bool, session_id: Option<&str>) -> Result<(), String> {
    if all && session_id.is_some() {
        return Err("pass either --all or a session id, not both".into());
    }
    Ok(())
}

// usage
decisions_args_valid(all_flag, session_id.as_deref())?;

Type guard

// (N/A — runtime CLI flag validation; use clap's `conflicts_with` instead)
// In the clap derive:
//   #[arg(long, conflicts_with = "all")]
//   session_id: Option<String>,
//   #[arg(long, conflicts_with = "session_id")]
//   all: bool,

Prevention

When it happens

Trigger: Invoking `ecc decisions --all <session-id>` or `ecc decisions --all --session <id>` (depending on the clap definition). Any code path that constructs a `Commands::Decisions { session_id: Some(..), all: true, .. }` variant and hands it to main's match arm at main.rs:2143.

Common situations: Shell aliases or scripts that always inject a session ID colliding with an interactive `--all` toggle. Copy-pasting a previous command and appending `--all` without dropping the session argument. Wrapper tools that default `session_id` to "latest" even when the user asked for all sessions.

Related errors


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