{"record":{"id":"1e7447e13b36f895","repo":"affaan-m/ECC","slug":"session-not-found-options-sessionid","errorCode":null,"errorMessage":"Session not found: ${options.sessionId}","messagePattern":"Session not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/sessions-cli.js","lineNumber":153,"sourceCode":"\n    store = await createStateStore({\n      dbPath: options.dbPath,\n      homeDir: process.env.HOME || os.homedir(),\n    });\n\n    if (!options.sessionId) {\n      const payload = store.listRecentSessions({ limit: options.limit });\n      if (options.json) {\n        console.log(JSON.stringify(payload, null, 2));\n      } else {\n        printSessionList(payload);\n      }\n      return;\n    }\n\n    const payload = store.getSessionDetail(options.sessionId);\n    if (!payload) {\n      throw new Error(`Session not found: ${options.sessionId}`);\n    }\n\n    if (options.json) {\n      console.log(JSON.stringify(payload, null, 2));\n    } else {\n      printSessionDetail(payload);\n    }\n  } catch (error) {\n    console.error(`Error: ${error.message}`);\n    process.exit(1);\n  } finally {\n    if (store) {\n      store.close();\n    }\n  }\n}\n\nif (require.main === module) {","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/sessions-cli.js#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List recent sessions first: `node scripts/sessions-cli.js --limit 20` and copy the exact id.","Verify --db points at the same DB the recording harness writes to.","Confirm the session was not pruned by retention/cleanup.","Re-run the original session to regenerate the record."],"exampleFix":"# before\nnode scripts/sessions-cli.js abc123\n# after\nnode scripts/sessions-cli.js --limit 20   # then use the exact id returned","handlingStrategy":"validation","validationCode":"const store = createSessionStore({ dbPath });\nconst ids = store.listRecentSessions({ limit: 50 }).sessions.map(s => s.id);\nif (!ids.includes(targetId)) { console.error(`Session not found: ${targetId}`); process.exit(2); }","typeGuard":null,"tryCatchPattern":"const detail = store.getSessionDetail(id);\nif (!detail) { console.error(`Session not found: ${id}`); process.exit(2); }","preventionTips":["Always resolve ids from listRecentSessions output rather than typing them.","Verify --db matches the recording harness's DB before lookup.","Pin retention so ids from recent logs still exist."],"tags":["cli","data-lookup","sessions-cli"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}