can1357/oh-my-pi · error · SessionResolutionError
--fork requires session persistence
Error message
--fork requires session persistence
What it means
--fork creates a new session branching from an existing one, which inherently requires session persistence. Passing --no-session with --fork throws this SessionResolutionError before any fork lookup occurs.
Source
Thrown at packages/coding-agent/src/main.ts:942
if (!message || !SESSION_ID_ARG_RE.test(message)) return;
const messageIndex = parsed.messages.indexOf(message);
if (messageIndex === -1) return;
parsed.resume = message;
parsed.continue = false;
parsed.messages.splice(messageIndex, 1);
}
/** 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();
}View on GitHub (pinned to 9690622007)
Solutions
- Remove --no-session; a fork must write a new session file.
- If you want to inspect an old session without forking, open the .jsonl directly instead of using --fork.
Example fix
// before omp --fork abc123 --no-session // after omp --fork abc123
Defensive patterns
Strategy: validation
Validate before calling
if (process.argv.includes("--fork") && process.argv.includes("--no-session"))
throw new Error("Forking writes a new session; --no-session is incompatible"); Prevention
- Never combine --fork with --no-session in wrapper scripts.
- If you only need to read an old session, inspect the .jsonl file instead of forking.
- Document fork as a persistence-requiring operation.
When it happens
Trigger: Running `omp --fork <session> --no-session` — parsed.fork set and parsed.noSession set.
Common situations: Scripts that blanket-append --no-session; users believing a fork is a read-only copy that needs no storage.
Related errors
- --from-${source} requires session persistence
- --dired and --zero are incompatible
- --from-claude and --from-codex cannot be used together
- --from-${source} cannot be combined with --continue, --resum
- --host-network is docker-only (compose overlay)
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/fbce36c17c6254e0.
Report an issue: GitHub.