affaan-m/ECC · error · anyhow::Error
No sessions found
Error message
No sessions found
What it means
Raised by `resolve_session_id` when the special value `"latest"` is requested but `db.get_latest_session()` returns `None` — the state store contains no sessions at all. Since there is no session to resolve, the helper returns this error instead of a session ID. It reflects an empty database, not a lookup failure for a specific ID.
Solutions
- Create a session first (start an ECC session) so `latest` has a target.
- Verify the data directory / profile actually contains sessions (`ecc sessions list`).
- If the store was wiped intentionally, re-run the sync/indexing that creates sessions.
- Use an explicit session ID from a known-good store instead of `latest`.
Example fix
// before $ ecc graph show --session latest error: No sessions found // after $ ecc sessions list # confirm sessions exist $ ecc graph show --session latest
Defensive patterns
Strategy: fallback
Validate before calling
# Ensure sessions exist before using 'latest'
count=$(ecc sessions list --json | jq 'length')
[ "$count" -gt 0 ] || { echo "no sessions; run a session first" >&2; exit 1; } Try / catch
match resolve_session_id(&db, "latest") {
Err(e) if e.to_string() == "No sessions found" => {
eprintln!("store empty — start a session before using 'latest'");
}
Err(e) => return Err(e),
Ok(id) => use_session(id),
} Prevention
- On fresh installs, create/record at least one session before commands that depend on 'latest'.
- Verify the ECC data directory actually points at a store with sessions.
- Prefer explicit session IDs in CI where the store may be empty.
When it happens
Trigger: Passing `--session latest` (or the equivalent argument) on a fresh install, after a database reset/wipe, or when session recording was disabled so no sessions were ever persisted.
Common situations: Running a session-dependent command on a brand-new machine; pointing ECC at an empty alternate home/data directory; after manually deleting rows from the sessions table; CI environments with no prior sessions.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Session not found
- Session not found
- Session not found
- Context graph entity not found
- Context graph observation #
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/8369ce48aaab22b2.
Report an issue: GitHub.
Appendix: 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 8321021c54)