{"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":"validation","errorClass":null,"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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/sessions-cli.js#L135-L171","documentation":"main in scripts/sessions-cli.js looks up the session detail via store.getSessionDetail(options.sessionId) and throws when the store returns no payload. This means no session record matches the given id.","triggerScenarios":"Running `node scripts/sessions-cli.js <id>` with an id that is misspelled, was deleted/pruned from the session store, or was created by a different store directory.","commonSituations":"Copy-pasting a truncated id, referencing a session from an old repo clone where the store isn't present, sessions cleaned up by a retention task.","solutions":["List available sessions first (e.g. `node scripts/sessions-cli.js --help` or the list command) and copy the exact id.","Verify the session store path/data exists for the current working directory.","Re-run with the full, untruncated session id."],"exampleFix":"// before\nnode scripts/sessions-cli.js abc12\n// after\nnode scripts/sessions-cli.js abc123e4-d56f-7890-abcd-ef1234567890","handlingStrategy":"try-catch","validationCode":"const exists = store.listSessions().some(s => s.id === sessionId);\nif (!exists) { console.error(`Session ${sessionId} not in store`); process.exit(2); }","typeGuard":"const sessionExists = (id, sessions) => sessions.some(s => s && s.id === id);","tryCatchPattern":"try { const payload = store.getSessionDetail(id); if (!payload) throw new Error(`Session not found: ${id}`); } catch (e) { console.error(e.message + ' — list sessions to get a valid id'); process.exit(2); }","preventionTips":["List sessions and copy the exact id instead of retyping it","Check that you're in the same repo/working dir as the session store","Don't reference sessions that may have been pruned by retention"],"tags":["cli","not-found","data"],"backgroundTag":"record-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}