{"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":"exception","errorClass":null,"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/01e15490f04e29cfefe3896951f43db46994d8ee/ecc2/src/main.rs#L2537-L2573","documentation":"Sibling guard to error 640, applied to the `graph sync` subcommand: passing `--all` together with a `session_id` is rejected because `--all` means \"sync every session\" while a session ID scopes to one. The check runs before `sync_runtime_session_metrics` so no work is performed for the invalid combination.","triggerScenarios":"Invoking `ecc graph sync --all <session-id>` or `ecc graph sync --all --session <id>`. Scripts that default `session_id` to \"latest\" and also pass `--all`. Combining a global sync flag with a scoped selector inadvertently.","commonSituations":"Copy-pasting a scoped sync command and appending `--all`. Aliases that always inject `--session latest`. Migration from per-session sync to bulk sync without removing the old argument.","solutions":["For bulk sync, drop the session ID: `ecc graph sync --all`.","For single-session sync, drop `--all`: `ecc graph sync <session-id>` (defaults to latest).","Fix wrapper scripts so `session_id` and `all` are never set together."],"exampleFix":"// before\necc graph sync --all latest\n\n// after\necc graph sync --all","handlingStrategy":"validation","validationCode":"// Validate graph sync args\nfn validate_sync_args(all: bool, session_id: Option<&str>) -> Result<(), String> {\n    if all && session_id.is_some() {\n        return Err(\"--all and a session id are mutually exclusive\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use clap `conflicts_with = \"session_id\"` on the `all` flag so the parser rejects the combo early.","Do not default `session_id` to \"latest\" in automation that also sets `--all`.","Document the mutual exclusion in `--help`."],"tags":["cli","arguments","graph","sync","validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}