affaan-m/ECC · error · anyhow::Error
No sessions found
Error message
No sessions found
What it means
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".
Source
Thrown at ecc2/src/main.rs:2913
Some(Commands::RunSession {
session_id,
task,
agent,
cwd,
}) => {
session::manager::run_session(&cfg, &session_id, &task, &agent, &cwd).await?;
}
}
Ok(())
}
fn resolve_session_id(db: &session::store::StateStore, value: &str) -> Result<String> {
if value == "latest" {
return db
.get_latest_session()?
.map(|session| session.id)
.ok_or_else(|| anyhow::anyhow!("No sessions found"));
}
db.get_session(value)?
.map(|session| session.id)
.ok_or_else(|| anyhow::anyhow!("Session not found: {value}"))
}
fn sync_runtime_session_metrics(
db: &session::store::StateStore,
cfg: &config::Config,
) -> Result<()> {
db.refresh_session_durations()?;
db.sync_cost_tracker_metrics(&cfg.cost_metrics_path())?;
db.sync_tool_activity_metrics(&cfg.tool_activity_metrics_path())?;
let _ = session::manager::enforce_session_heartbeats(db, cfg)?;
let _ = session::manager::enforce_budget_hard_limits(db, cfg)?;
Ok(())
}View on GitHub (pinned to 01e15490f0)
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`.
Example fix
// before ecc decisions # resolves "latest" on empty store -> error // after ecc run --task "seed" --agent claude # creates a session ecc decisions # now resolves
Defensive patterns
Strategy: validation
Validate before calling
// Guard against empty store before resolving 'latest'
fn latest_session_or_hint(db: &StateStore) -> Result<String> {
match db.get_latest_session()? {
Some(s) => Ok(s.id),
None => Err(anyhow!("no sessions yet; create one with `ecc run` first")),
}
} Try / catch
match db.get_latest_session() {
Ok(Some(s)) => s.id,
Ok(None) => { eprintln!("No sessions found. Run `ecc run ...` first."); std::process::exit(1); }
Err(e) => return Err(e.into()),
} Prevention
- 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.
When it happens
Trigger: 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"`.
Common situations: 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.
Related errors
- Session not found: {value}
- Session not found: {from_id}
- Missing value for --db
- Session not found: {resolved_id}
- Scheduled task not found: {schedule_id}
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/8369ce48aaab22b2.
Report an issue: GitHub.