affaan-m/ECC · error · Error

Session not found: ${options.sessionId}

Error message

Session not found: ${options.sessionId}

What it means

Thrown by sessions-cli.js after getSessionDetail returns a falsy payload for the given session id. The store lookup (over the configured DB path) found no matching session, so the CLI refuses to print an empty/fake detail record.

Source

Thrown at scripts/sessions-cli.js:153

    store = await createStateStore({
      dbPath: options.dbPath,
      homeDir: process.env.HOME || os.homedir(),
    });

    if (!options.sessionId) {
      const payload = store.listRecentSessions({ limit: options.limit });
      if (options.json) {
        console.log(JSON.stringify(payload, null, 2));
      } else {
        printSessionList(payload);
      }
      return;
    }

    const payload = store.getSessionDetail(options.sessionId);
    if (!payload) {
      throw new Error(`Session not found: ${options.sessionId}`);
    }

    if (options.json) {
      console.log(JSON.stringify(payload, null, 2));
    } else {
      printSessionDetail(payload);
    }
  } catch (error) {
    console.error(`Error: ${error.message}`);
    process.exit(1);
  } finally {
    if (store) {
      store.close();
    }
  }
}

if (require.main === module) {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. List recent sessions first: `node scripts/sessions-cli.js --limit 20` and copy the exact id.
  2. Verify --db points at the same DB the recording harness writes to.
  3. Confirm the session was not pruned by retention/cleanup.
  4. Re-run the original session to regenerate the record.

Example fix

# before
node scripts/sessions-cli.js abc123
# after
node scripts/sessions-cli.js --limit 20   # then use the exact id returned
Defensive patterns

Strategy: validation

Validate before calling

const store = createSessionStore({ dbPath });
const ids = store.listRecentSessions({ limit: 50 }).sessions.map(s => s.id);
if (!ids.includes(targetId)) { console.error(`Session not found: ${targetId}`); process.exit(2); }

Try / catch

const detail = store.getSessionDetail(id);
if (!detail) { console.error(`Session not found: ${id}`); process.exit(2); }

Prevention

When it happens

Trigger: Passing a session id that does not exist in the sessions DB; pointing --db at the wrong database file; the session was pruned or the DB migrated; id typo or truncation.

Common situations: Copy-pasting a stale id from old logs; running against a fresh home dir with no recorded sessions; --db path pointing at a different user's data; partial id that does not match.

Related errors


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