can1357/oh-my-pi · error · Error
Session file not found: ${resolved}
Error message
Session file not found: ${resolved} What it means
`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.
Source
Thrown at packages/coding-agent/src/cli/render-cli.ts:144
for (const callback of immediate) callback();
if (this.#renders.size === 0) continue;
const renders = [...this.#renders.values()];
this.#renders.clear();
for (const callback of renders) callback();
}
}
}
/** Resolve the target session file from a path, id prefix, or cwd default. */
async function resolveTargetSession(sessionArg: string | undefined, cwd: string): Promise<string> {
if (sessionArg) {
if (sessionArg.includes("/") || sessionArg.includes("\\") || sessionArg.endsWith(".jsonl")) {
const resolved = path.resolve(sessionArg);
try {
await fs.access(resolved);
return resolved;
} catch (err) {
if (isEnoent(err)) throw new Error(`Session file not found: ${resolved}`);
throw err;
}
}
const match = await resolveResumableSession(sessionArg, cwd);
if (!match) throw new Error(`Session "${sessionArg}" not found.`);
return match.session.path;
}
const recent = await findMostRecentSession(SessionManager.getDefaultSessionDir(cwd));
if (!recent) throw new Error(`No sessions found for ${cwd}. Pass a session file or id.`);
return recent;
}
function formatBytes(bytes: number): string {
if (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
if (bytes >= 1024) return `${(bytes / 1024).toFixed(1)} KiB`;
return `${bytes} B`;
}
View on GitHub (pinned to 9690622007)
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
Example fix
// before omp render sessins/my-session.jsonl // after omp render sessions/my-session.jsonl # or: omp render <session-id>
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from "node:fs";
if ((arg.includes("/") || arg.includes("\\") || arg.endsWith(".jsonl")) && !existsSync(path.resolve(arg))) {
console.error(`Session file not found: ${path.resolve(arg)}`);
process.exit(1);
} Try / catch
try {
const sessionPath = await resolveTargetSession(arg, cwd);
} catch (err) {
if (err instanceof Error && err.message.startsWith("Session file not found:")) {
console.error(`${err.message} — check the path or pass a session id`);
}
throw err;
} Prevention
- Use absolute paths or run from the project root
- Tab-complete session file paths
- Prefer session ids over paths to avoid path-resolution mistakes
When it happens
Trigger: `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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Cleanse session could not be persisted
- Import source is neither file nor directory: ${target}
- Session "${sessionArg}" not found.
- No sessions found for ${cwd}. Pass a session file or id.
- No files matched "${pattern}"
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/c0ca3c15897e364f.
Report an issue: GitHub.