{"record":{"id":"c0ca3c15897e364f","repo":"can1357/oh-my-pi","slug":"session-file-not-found-resolved","errorCode":null,"errorMessage":"Session file not found: ${resolved}","messagePattern":"Session file not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/render-cli.ts","lineNumber":144,"sourceCode":"\t\t\tfor (const callback of immediate) callback();\n\t\t\tif (this.#renders.size === 0) continue;\n\t\t\tconst renders = [...this.#renders.values()];\n\t\t\tthis.#renders.clear();\n\t\t\tfor (const callback of renders) callback();\n\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","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/render-cli.ts#L126-L162","documentation":"`resolveTargetSession` accepts a filesystem path (containing `/` or `\\` or ending in `.jsonl`) as a session argument. It resolves the path absolutely and checks accessibility with `fs.access`; a missing file produces this descriptive error instead of the raw ENOENT. It is the render CLI's friendly 'file you pointed at doesn't exist' failure.","triggerScenarios":"`omp render ./path/to/session.jsonl` (or any argument with path separators / .jsonl suffix) where `path.resolve(sessionArg)` names a file that does not exist.","commonSituations":"Typo in the path; running from a different working directory with a relative path; session file deleted or moved by session cleanup; passing an id that happens to contain a slash.","solutions":["Check the path spelling and re-run with the correct relative or absolute path","Run `ls` on the sessions directory to find the actual .jsonl file","Use the session id instead of a path so it resolves via the session store","Restore the file from backup if it was deleted"],"exampleFix":"// before\nomp render sessins/my-session.jsonl\n// after\nomp render sessions/my-session.jsonl   # or: omp render <session-id>","handlingStrategy":"validation","validationCode":"import { existsSync } from \"node:fs\";\nif ((arg.includes(\"/\") || arg.includes(\"\\\\\") || arg.endsWith(\".jsonl\")) && !existsSync(path.resolve(arg))) {\n  console.error(`Session file not found: ${path.resolve(arg)}`);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const sessionPath = await resolveTargetSession(arg, cwd);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Session file not found:\")) {\n    console.error(`${err.message} — check the path or pass a session id`);\n  }\n  throw err;\n}","preventionTips":["Use absolute paths or run from the project root","Tab-complete session file paths","Prefer session ids over paths to avoid path-resolution mistakes"],"tags":["filesystem","cli","session"],"backgroundTag":"file-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}