{"record":{"id":"2d1e5f6d7ec22ba0","repo":"affaan-m/ECC","slug":"decisions-does-not-accept-a-session-id-when-all","errorCode":null,"errorMessage":"decisions does not accept a session ID when --all is set","messagePattern":"decisions does not accept a session ID when --all is set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":2143,"sourceCode":"            alternatives,\n            json,\n        }) => {\n            let resolved_id = resolve_session_id(&db, session_id.as_deref().unwrap_or(\"latest\"))?;\n            let entry = db.insert_decision(&resolved_id, &decision, &alternatives, &reasoning)?;\n            if json {\n                println!(\"{}\", serde_json::to_string_pretty(&entry)?);\n            } else {\n                println!(\"{}\", format_logged_decision_human(&entry));\n            }\n        }\n        Some(Commands::Decisions {\n            session_id,\n            all,\n            json,\n            limit,\n        }) => {\n            if all && session_id.is_some() {\n                return Err(anyhow::anyhow!(\n                    \"decisions does not accept a session ID when --all is set\"\n                ));\n            }\n            let entries = if all {\n                db.list_decisions(limit)?\n            } else {\n                let resolved_id =\n                    resolve_session_id(&db, session_id.as_deref().unwrap_or(\"latest\"))?;\n                db.list_decisions_for_session(&resolved_id, limit)?\n            };\n            if json {\n                println!(\"{}\", serde_json::to_string_pretty(&entries)?);\n            } else {\n                println!(\"{}\", format_decisions_human(&entries, all));\n            }\n        }\n        Some(Commands::Migrate { command }) => match command {\n            MigrationCommands::Audit { source, json } => {","sourceCodeStart":2125,"sourceCodeEnd":2161,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/ecc2/src/main.rs#L2125-L2161","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Drop the session ID argument when using `--all`: run `ecc decisions --all`.","If you want a single session, remove `--all`: run `ecc decisions <session-id>` (or `ecc decisions` for latest).","Audit shell aliases / wrapper scripts to ensure `session_id` and `all` are mutually exclusive before invoking the CLI."],"exampleFix":"// before\necc decisions --all latest\n\n// after\necc decisions --all","handlingStrategy":"validation","validationCode":"// Validate before constructing the command\nfn decisions_args_valid(all: bool, session_id: Option<&str>) -> Result<(), String> {\n    if all && session_id.is_some() {\n        return Err(\"pass either --all or a session id, not both\".into());\n    }\n    Ok(())\n}\n\n// usage\ndecisions_args_valid(all_flag, session_id.as_deref())?;","typeGuard":"// (N/A — runtime CLI flag validation; use clap's `conflicts_with` instead)\n// In the clap derive:\n//   #[arg(long, conflicts_with = \"all\")]\n//   session_id: Option<String>,\n//   #[arg(long, conflicts_with = \"session_id\")]\n//   all: bool,","tryCatchPattern":null,"preventionTips":["Declare the arguments mutually exclusive at the clap level with `conflicts_with` so the error is surfaced by the parser before main runs.","Avoid defaulting `session_id` to \"latest\" in wrapper scripts when `--all` may also be passed.","Document the exclusive relationship in the command's `--help` text."],"tags":["cli","arguments","validation","decisions"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}