{"record":{"id":"8369ce48aaab22b2","repo":"affaan-m/ECC","slug":"no-sessions-found","errorCode":null,"errorMessage":"No sessions found","messagePattern":"No sessions found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":2913,"sourceCode":"        Some(Commands::RunSession {\n            session_id,\n            task,\n            agent,\n            cwd,\n        }) => {\n            session::manager::run_session(&cfg, &session_id, &task, &agent, &cwd).await?;\n        }\n    }\n\n    Ok(())\n}\n\nfn resolve_session_id(db: &session::store::StateStore, value: &str) -> Result<String> {\n    if value == \"latest\" {\n        return db\n            .get_latest_session()?\n            .map(|session| session.id)\n            .ok_or_else(|| anyhow::anyhow!(\"No sessions found\"));\n    }\n\n    db.get_session(value)?\n        .map(|session| session.id)\n        .ok_or_else(|| anyhow::anyhow!(\"Session not found: {value}\"))\n}\n\nfn sync_runtime_session_metrics(\n    db: &session::store::StateStore,\n    cfg: &config::Config,\n) -> Result<()> {\n    db.refresh_session_durations()?;\n    db.sync_cost_tracker_metrics(&cfg.cost_metrics_path())?;\n    db.sync_tool_activity_metrics(&cfg.tool_activity_metrics_path())?;\n    let _ = session::manager::enforce_session_heartbeats(db, cfg)?;\n    let _ = session::manager::enforce_budget_hard_limits(db, cfg)?;\n    Ok(())\n}","sourceCodeStart":2895,"sourceCodeEnd":2931,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/ecc2/src/main.rs#L2895-L2931","documentation":"Raised inside `resolve_session_id` when the caller asks for `\"latest\"` but `db.get_latest_session()?` returns `None` — i.e. the state store has zero sessions recorded. The helper is shared across many subcommands (decisions, graph sync, connectors with a default session, etc.), so this error can surface from unrelated commands. It specifically means \"no session has ever been created in this store\".","triggerScenarios":"Any command that resolves `\"latest\"` (the default) on a brand-new or empty state database. First run of `ecc` before any session has been recorded. Pointing `--state`/config at a freshly initialized SQLite file with no rows. Connectors whose `session_id` field resolves to `\"latest\"`.","commonSituations":"Initial setup before the first `ecc run`/`ecc session create`. Wrong state path in config (empty file). A wiped/reset database. CI environments that spin up a clean state per run.","solutions":["Create at least one session first (e.g. `ecc run ...` or the relevant session-create command).","Check that the configured state store path is the one that actually contains your sessions.","If you intended a specific session, pass its explicit ID instead of relying on `latest`."],"exampleFix":"// before\necc decisions                  # resolves \"latest\" on empty store -> error\n\n// after\necc run --task \"seed\" --agent claude   # creates a session\necc decisions                  # now resolves","handlingStrategy":"validation","validationCode":"// Guard against empty store before resolving 'latest'\nfn latest_session_or_hint(db: &StateStore) -> Result<String> {\n    match db.get_latest_session()? {\n        Some(s) => Ok(s.id),\n        None => Err(anyhow!(\"no sessions yet; create one with `ecc run` first\")),\n    }\n}","typeGuard":null,"tryCatchPattern":"match db.get_latest_session() {\n    Ok(Some(s)) => s.id,\n    Ok(None) => { eprintln!(\"No sessions found. Run `ecc run ...` first.\"); std::process::exit(1); }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["On fresh checkouts, create a session before running any command that resolves `latest`.","Verify the configured state store path points at a populated DB.","In CI, seed a session as the first step of the pipeline."],"tags":["session","database","resolve","cli"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}