affaan-m/ECC · error

graph sync does not accept a session ID when --all is set

Error message

graph sync does not accept a session ID when --all is set

What it means

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.

Source

Thrown at ecc2/src/main.rs:2555

                let detail = db
                    .get_context_entity_detail(entity_id, limit)?
                    .ok_or_else(|| {
                        anyhow::anyhow!("Context graph entity not found: {entity_id}")
                    })?;
                if json {
                    println!("{}", serde_json::to_string_pretty(&detail)?);
                } else {
                    println!("{}", format_graph_entity_detail_human(&detail));
                }
            }
            GraphCommands::Sync {
                session_id,
                all,
                limit,
                json,
            } => {
                if all && session_id.is_some() {
                    return Err(anyhow::anyhow!(
                        "graph sync does not accept a session ID when --all is set"
                    ));
                }
                sync_runtime_session_metrics(&db, &cfg)?;
                let resolved_session_id = if all {
                    None
                } else {
                    Some(resolve_session_id(
                        &db,
                        session_id.as_deref().unwrap_or("latest"),
                    )?)
                };
                let stats = db.sync_context_graph_history(resolved_session_id.as_deref(), limit)?;
                if json {
                    println!("{}", serde_json::to_string_pretty(&stats)?);
                } else {
                    println!(
                        "{}",

View on GitHub (pinned to 01e15490f0)

Solutions

  1. For bulk sync, drop the session ID: `ecc graph sync --all`.
  2. For single-session sync, drop `--all`: `ecc graph sync <session-id>` (defaults to latest).
  3. Fix wrapper scripts so `session_id` and `all` are never set together.

Example fix

// before
ecc graph sync --all latest

// after
ecc graph sync --all
Defensive patterns

Strategy: validation

Validate before calling

// Validate graph sync args
fn validate_sync_args(all: bool, session_id: Option<&str>) -> Result<(), String> {
    if all && session_id.is_some() {
        return Err("--all and a session id are mutually exclusive".into());
    }
    Ok(())
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/c32ce501d2a4514b. Report an issue: GitHub.