{"record":{"id":"f71bf3a7e57e286d","repo":"affaan-m/ECC","slug":"worktree-status-does-not-accept-a-session-id-when","errorCode":null,"errorMessage":"worktree-status does not accept a session ID when --all is set","messagePattern":"worktree-status does not accept a session ID when --all is set","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":1995,"sourceCode":"            let id = session_id.unwrap_or_else(|| \"latest\".to_string());\n            let status = session::manager::get_status(&db, &cfg, &id)?;\n            println!(\"{status}\");\n        }\n        Some(Commands::Team { session_id, depth }) => {\n            sync_runtime_session_metrics(&db, &cfg)?;\n            let id = session_id.unwrap_or_else(|| \"latest\".to_string());\n            let team = session::manager::get_team_status(&db, &id, depth)?;\n            println!(\"{team}\");\n        }\n        Some(Commands::WorktreeStatus {\n            session_id,\n            all,\n            json,\n            patch,\n            check,\n        }) => {\n            if all && session_id.is_some() {\n                return Err(anyhow::anyhow!(\n                    \"worktree-status does not accept a session ID when --all is set\"\n                ));\n            }\n            let reports = if all {\n                session::manager::list_sessions(&db)?\n                    .into_iter()\n                    .map(|session| build_worktree_status_report(&session, patch))\n                    .collect::<Result<Vec<_>>>()?\n            } else {\n                let id = session_id.unwrap_or_else(|| \"latest\".to_string());\n                let resolved_id = resolve_session_id(&db, &id)?;\n                let session = db\n                    .get_session(&resolved_id)?\n                    .ok_or_else(|| anyhow::anyhow!(\"Session not found: {resolved_id}\"))?;\n                vec![build_worktree_status_report(&session, patch)?]\n            };\n            if json {\n                if all {","sourceCodeStart":1977,"sourceCodeEnd":2013,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/main.rs#L1977-L2013","documentation":"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.","triggerScenarios":"Running `ecc2 worktree-status --all <session-id>` (or with `-s <id>`) — i.e. `all && session_id.is_some()`.","commonSituations":"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.","solutions":["Remove the session ID argument and keep `--all` for an aggregate report.","Remove `--all` and keep the single session ID for a per-session report.","Update any scripts/aliases to pass either the flag or the ID, never both.","Use `--help` on the subcommand to confirm the accepted argument forms."],"exampleFix":"// before (shell)\necc2 worktree-status --all mysession-id\n\n// after\necc2 worktree-status --all        # every session\necc2 worktree-status mysession-id # one session","handlingStrategy":"validation","validationCode":"// shell: enforce one mode before invoking\n[ -n \"$SESSION_ID\" ] && $ALL_MODE && { echo \"pass either --all or a session ID, not both\"; exit 1; }","typeGuard":"fn worktree_status_args_ok(all: bool, session_id: &Option<String>) -> bool {\n    !(all && session_id.is_some())\n}","tryCatchPattern":"// in scripts, capture and surface the CLI's validation error\necc2 worktree-status \"$@\" || { echo \"worktree-status argument error\"; exit 1; }","preventionTips":["Read `--help` for subcommands before scripting flag combinations.","Build wrappers that pass exactly one of (--all | session id).","Avoid shell aliases that hardcode flags like --all.","Test argument combinations once and encode the valid ones in scripts."],"tags":["cli","arguments","worktree","rust"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}