can1357/oh-my-pi · error · SessionResolutionError

Session "${forkSource}" not found.

Error message

Session "${forkSource}" not found.

What it means

When --fork is given a session identifier that is neither a path (contains / or \ or ends with .jsonl) nor resolvable among recent sessions, resolveResumableSession returns no match and this SessionResolutionError is thrown, with a hint pointing at `omp --resume`.

Source

Thrown at packages/coding-agent/src/main.ts:950

/** Resolves CLI session flags into an existing, forked, in-memory, or cancelled session manager. */
export async function createSessionManager(
	parsed: Args,
	cwd: string,
	activeSettings: Settings = settings,
	askToMoveSession: SessionPrompt = promptMoveSession,
): Promise<SessionManager | undefined> {
	if (parsed.fork) {
		if (parsed.noSession) {
			throw new SessionResolutionError("--fork requires session persistence");
		}
		const forkSource = parsed.fork;
		if (forkSource.includes("/") || forkSource.includes("\\") || forkSource.endsWith(".jsonl")) {
			return await SessionManager.forkFrom(forkSource, cwd, parsed.sessionDir);
		}
		const match = await resolveResumableSession(forkSource, cwd, parsed.sessionDir);
		if (!match) {
			throw new SessionResolutionError(
				`Session "${forkSource}" not found.`,
				"Run `omp --resume` without an argument to pick from recent sessions, or `omp` to start a new one.",
			);
		}
		return await SessionManager.forkFrom(match.session.path, cwd, parsed.sessionDir);
	}

	if (parsed.noSession) {
		return SessionManager.inMemory();
	}
	normalizeContinueSessionArgs(parsed);

	if (typeof parsed.resume === "string") {
		const sessionArg = parsed.resume;
		if (sessionArg.includes("/") || sessionArg.includes("\\") || sessionArg.endsWith(".jsonl")) {
			return await SessionManager.open(sessionArg, parsed.sessionDir);
		}
		const match = await resolveResumableSession(sessionArg, cwd, parsed.sessionDir);

View on GitHub (pinned to 9690622007)

Solutions

  1. Run `omp --resume` without an argument to browse recent sessions and copy the correct identifier.
  2. Pass the session's full .jsonl path instead of the short ID.
  3. If the session lives in another project, add --session-dir pointing there.

Example fix

// before
omp --fork abc12   # typo
// after
omp --fork abc123   # full id from `omp --resume` list
Defensive patterns

Strategy: validation

Validate before calling

import * as fsSync from "node:fs";
const id = "abc123";
const asPath = id.includes("/") || id.endsWith(".jsonl") ? id : null;
// pre-check by listing sessions dir or running `omp --resume` picker first

Try / catch

try {
  await forkSession(id);
} catch (err) {
  if (err.message.endsWith("not found.")) {
    // surface `omp --resume` picker or full path hint to the user
  }
}

Prevention

When it happens

Trigger: `omp --fork <name>` where <name> doesn't match any resumable session for the current cwd/sessionDir (typo, stale ID, session from another project without --session-dir).

Common situations: Typo or truncated session ID; session created in a different project directory; using a custom --session-dir but passing an ID from the default dir (or vice versa); session file deleted by cleanup.

Related errors


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