{"record":{"id":"53a02f092659e2c0","repo":"can1357/oh-my-pi","slug":"session-sessionarg-not-found","errorCode":null,"errorMessage":"Session \"${sessionArg}\" not found.","messagePattern":"Session \"(.+?)\" not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/render-cli.ts","lineNumber":149,"sourceCode":"\t\t}\n\t}\n}\n\n/** Resolve the target session file from a path, id prefix, or cwd default. */\nasync function resolveTargetSession(sessionArg: string | undefined, cwd: string): Promise<string> {\n\tif (sessionArg) {\n\t\tif (sessionArg.includes(\"/\") || sessionArg.includes(\"\\\\\") || sessionArg.endsWith(\".jsonl\")) {\n\t\t\tconst resolved = path.resolve(sessionArg);\n\t\t\ttry {\n\t\t\t\tawait fs.access(resolved);\n\t\t\t\treturn resolved;\n\t\t\t} catch (err) {\n\t\t\t\tif (isEnoent(err)) throw new Error(`Session file not found: ${resolved}`);\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t\tconst match = await resolveResumableSession(sessionArg, cwd);\n\t\tif (!match) throw new Error(`Session \"${sessionArg}\" not found.`);\n\t\treturn match.session.path;\n\t}\n\tconst recent = await findMostRecentSession(SessionManager.getDefaultSessionDir(cwd));\n\tif (!recent) throw new Error(`No sessions found for ${cwd}. Pass a session file or id.`);\n\treturn recent;\n}\n\nfunction formatBytes(bytes: number): string {\n\tif (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;\n\tif (bytes >= 1024) return `${(bytes / 1024).toFixed(1)} KiB`;\n\treturn `${bytes} B`;\n}\n\nfunction formatMs(ms: number): string {\n\treturn `${ms.toFixed(0)} ms`;\n}\n\n/** Render the resolved session and report timings. Returns the exit code. */","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/render-cli.ts#L131-L167","documentation":"When the argument is not a path, `resolveTargetSession` looks it up as a resumable session id/title via `resolveResumableSession`. If nothing matches, this error says the given session id doesn't exist in the session store. It prevents silently rendering a wrong or empty session.","triggerScenarios":"`omp render <id>` where `<id>` matches no known resumable session (typo, session from another project directory, session file already pruned).","commonSituations":"Copying a partial id; switching machines (session history is local); cleanup policies removing old sessions; using an id from a different `cwd`'s session dir.","solutions":["List available sessions (e.g. `omp render` with no arg lists recent sessions) and copy the exact id","Check you are in the same project directory the session was created in","Pass the full path to the session .jsonl file instead of the id","Verify the session still exists on disk in the default session dir"],"exampleFix":"// before\nomp render ab12cd  # truncated/guessed id\n// after\nomp render ab12cd34-5678-90ab-cdef-1234567890ab  # full id from session list","handlingStrategy":"validation","validationCode":"const match = await resolveResumableSession(sessionArg, cwd);\nif (!match) {\n  console.error(`Session \"${sessionArg}\" not found. List sessions first.`);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const target = await resolveTargetSession(id, cwd);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"not found\")) {\n    console.error(`Unknown session id \"${id}\" — run the list command to see available ids`);\n    return;\n  }\n  throw err;\n}","preventionTips":["Copy full session ids from the session list, never abbreviate","Stay in the same project directory the session was created in","Be aware sessions are local per-machine — ids don't transfer"],"tags":["cli","session","lookup"],"backgroundTag":"session-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}