can1357/oh-my-pi · error · Error

Session "${sessionArg}" not found.

Error message

Session "${sessionArg}" not found.

What it means

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.

Source

Thrown at packages/coding-agent/src/cli/render-cli.ts:149

		}
	}
}

/** 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`;
}

function formatMs(ms: number): string {
	return `${ms.toFixed(0)} ms`;
}

/** Render the resolved session and report timings. Returns the exit code. */

View on GitHub (pinned to 9690622007)

Solutions

  1. List available sessions (e.g. `omp render` with no arg lists recent sessions) and copy the exact id
  2. Check you are in the same project directory the session was created in
  3. Pass the full path to the session .jsonl file instead of the id
  4. Verify the session still exists on disk in the default session dir

Example fix

// before
omp render ab12cd  # truncated/guessed id
// after
omp render ab12cd34-5678-90ab-cdef-1234567890ab  # full id from session list
Defensive patterns

Strategy: validation

Validate before calling

const match = await resolveResumableSession(sessionArg, cwd);
if (!match) {
  console.error(`Session "${sessionArg}" not found. List sessions first.`);
  process.exit(1);
}

Try / catch

try {
  const target = await resolveTargetSession(id, cwd);
} catch (err) {
  if (err instanceof Error && err.message.includes("not found")) {
    console.error(`Unknown session id "${id}" — run the list command to see available ids`);
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: `omp render <id>` where `<id>` matches no known resumable session (typo, session from another project directory, session file already pruned).

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/53a02f092659e2c0. Report an issue: GitHub.