{"record":{"id":"2cc50a286fc5e7bf","repo":"affaan-m/ECC","slug":"merge-worktree-does-not-accept-a-session-id-when","errorCode":null,"errorMessage":"merge-worktree does not accept a session ID when --all is set","messagePattern":"merge-worktree does not accept a session ID when --all is set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":2072,"sourceCode":"                    println!(\"{}\", serde_json::to_string_pretty(&reports)?);\n                } else {\n                    println!(\"{}\", serde_json::to_string_pretty(&reports[0])?);\n                }\n            } else {\n                println!(\"{}\", format_worktree_resolution_reports_human(&reports));\n            }\n            if check {\n                std::process::exit(worktree_resolution_reports_exit_code(&reports));\n            }\n        }\n        Some(Commands::MergeWorktree {\n            session_id,\n            all,\n            json,\n            keep_worktree,\n        }) => {\n            if all && session_id.is_some() {\n                return Err(anyhow::anyhow!(\n                    \"merge-worktree does not accept a session ID when --all is set\"\n                ));\n            }\n            if all {\n                let outcome = session::manager::merge_ready_worktrees(&db, !keep_worktree).await?;\n                if json {\n                    println!(\"{}\", serde_json::to_string_pretty(&outcome)?);\n                } else {\n                    println!(\"{}\", format_bulk_worktree_merge_human(&outcome));\n                }\n            } else {\n                let id = session_id.unwrap_or_else(|| \"latest\".to_string());\n                let resolved_id = resolve_session_id(&db, &id)?;\n                let outcome =\n                    session::manager::merge_session_worktree(&db, &resolved_id, !keep_worktree)\n                        .await?;\n                if json {\n                    println!(\"{}\", serde_json::to_string_pretty(&outcome)?);","sourceCodeStart":2054,"sourceCodeEnd":2090,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/ecc2/src/main.rs#L2054-L2090","documentation":"Argument-conflict error from the MergeWorktree command handler in ecc2/src/main.rs. When --all is set together with a session_id, the handler bails: \"merge-worktree does not accept a session ID when --all is set\". The --all branch calls merge_ready_worktrees across every session, so naming one session is contradictory.","triggerScenarios":"Running `merge-worktree --all <session_id>` such that both `all` is true and `session_id` is Some.","commonSituations":"User assumed --all plus an id scopes the merge; a wrapper script always appends an id; copy-paste from a single-session invocation.","solutions":["Drop either --all or the session id.","Check --help for the mutual exclusivity.","Fix any wrapper script that unconditionally appends an id."],"exampleFix":"# before\n$ ecc merge-worktree --all abc123\n\n# after (pick one)\n$ ecc merge-worktree --all\n$ ecc merge-worktree abc123","handlingStrategy":"validation","validationCode":"if all && session_id.is_some() {\n    eprintln!(\"--all cannot be combined with a session id\");\n    return Ok(());\n}","typeGuard":"fn args_consistent(all: bool, session_id: &Option<String>) -> bool {\n    !(all && session_id.is_some())\n}","tryCatchPattern":"if all {\n    if session_id.is_some() {\n        eprintln!(\"ignoring session id because --all was set\");\n    }\n    let outcome = session::manager::merge_ready_worktrees(&db, !keep_worktree).await?;\n    // ...\n} else {\n    // single-session merge\n}","preventionTips":["Read --help to learn which flags are mutually exclusive.","Use clap's `conflicts_with` to enforce mutual exclusivity at parse time.","Audit wrapper scripts that append positional args unconditionally.","Prefer explicit --all or an explicit id, never both."],"tags":["rust","cli","args","worktree"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}