{"record":{"id":"c32ce501d2a4514b","repo":"affaan-m/ECC","slug":"graph-sync-does-not-accept-a-session-id-when-all","errorCode":null,"errorMessage":"graph sync does not accept a session ID when --all is set","messagePattern":"graph sync 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":2555,"sourceCode":"                let detail = db\n                    .get_context_entity_detail(entity_id, limit)?\n                    .ok_or_else(|| {\n                        anyhow::anyhow!(\"Context graph entity not found: {entity_id}\")\n                    })?;\n                if json {\n                    println!(\"{}\", serde_json::to_string_pretty(&detail)?);\n                } else {\n                    println!(\"{}\", format_graph_entity_detail_human(&detail));\n                }\n            }\n            GraphCommands::Sync {\n                session_id,\n                all,\n                limit,\n                json,\n            } => {\n                if all && session_id.is_some() {\n                    return Err(anyhow::anyhow!(\n                        \"graph sync does not accept a session ID when --all is set\"\n                    ));\n                }\n                sync_runtime_session_metrics(&db, &cfg)?;\n                let resolved_session_id = if all {\n                    None\n                } else {\n                    Some(resolve_session_id(\n                        &db,\n                        session_id.as_deref().unwrap_or(\"latest\"),\n                    )?)\n                };\n                let stats = db.sync_context_graph_history(resolved_session_id.as_deref(), limit)?;\n                if json {\n                    println!(\"{}\", serde_json::to_string_pretty(&stats)?);\n                } else {\n                    println!(\n                        \"{}\",","sourceCodeStart":2537,"sourceCodeEnd":2573,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/main.rs#L2537-L2573","documentation":"This validation error fires in the graph sync command when the user passes both `--all` and a `session_id`. The two options are mutually exclusive: `--all` syncs every session (resolved_session_id becomes `None`), while a session ID targets one session. The command rejects the ambiguous combination up front via `anyhow::anyhow!`.","triggerScenarios":"Invoking `ecc graph sync --all --session <id>` (or passing a positional session ID together with `--all`), which makes the target session ambiguous.","commonSituations":"Copy-pasting a full example command from docs and appending `--all`; shell scripts that append `--all` unconditionally while already passing a session; users unsure whether `--all` overrides an explicit session.","solutions":["Remove `--all` if you want to sync only the given session ID.","Remove the `--session <id>` argument if you want to sync everything.","Update wrapping scripts to pass either `--all` or a session ID, never both.","Run `ecc graph sync --help` to confirm the option semantics."],"exampleFix":"// before\n$ ecc graph sync --all --session abc-123\nerror: graph sync does not accept a session ID when --all is set\n// after\n$ ecc graph sync --session abc-123   # one session\n# or\n$ ecc graph sync --all               # all sessions","handlingStrategy":"validation","validationCode":"# Script guard: pass exactly one targeting mode\nif [ -n \"$SESSION_ID\" ] && [ \"$ALL\" = \"1\" ]; then\n  echo \"choose either --all or --session, not both\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --all and --session as mutually exclusive in all wrappers/scripts.","Decide targeting once (scoped vs global) and build the command accordingly."],"tags":["cli","argument-validation","mutually-exclusive"],"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"}