can1357/oh-my-pi · error · SessionResolutionError

Selected ${sourceName} session is no longer available

Error message

Selected ${sourceName} session is no longer available

What it means

After listing, main.ts looks up the session matching the user's selection by both `id` and `path` in the just-fetched list. If no entry matches (the stored selection is stale), it throws this `SessionResolutionError`. The session you picked was deleted or altered between listing and matching, or selection state refers to an old path.

Source

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

							showCwd: true,
							allowDelete: false,
							allowGlobalScope: false,
							historySearch: false,
						},
					);
				} finally {
					resumeStartupWatchdog();
				}
				if (!selected) {
					writeStartupNotice(parsedArgs, `${chalk.dim(`No ${sourceName} session selected`)}\n`);
					stopStartupWatchdog();
					process.exit(0);
				}
				const foreignSession = foreignSessions.find(
					session => session.id === selected.id && session.path === selected.path,
				);
				if (!foreignSession) {
					throw new SessionResolutionError(`Selected ${sourceName} session is no longer available`);
				}
				try {
					sessionManager = await logger.time(
						`import${sourceName}Session`,
						persistForeignSession,
						store,
						foreignSession,
						{ fallbackCwd: cwd, sessionDir: parsedArgs.sessionDir },
					);
				} catch (error) {
					const message = error instanceof Error ? error.message : String(error);
					throw new SessionResolutionError(`Failed to import ${sourceName} session: ${message}`);
				}
			} else {
				sessionManager = await logger.time(
					"createSessionManager",
					createSessionManager,
					parsedArgs,

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-run and pick the session interactively from the fresh list instead of reusing saved selection.
  2. Verify the session still exists in the foreign tool (`claude`/`codex` resume list) and restore or recreate it if needed.
  3. If the project directory moved, start omp from the new directory so the path matches, or update the saved selection.

Example fix

// before (stale saved selection)
omp --from-claude --session <old-id>   # path no longer matches

// after
omp --from-claude   # choose from the current list
Defensive patterns

Strategy: retry

Validate before calling

// Re-enumerate foreign sessions and confirm the selected id/path still exists before resuming
const sessions = await store.list();
if (!sessions.some(s => s.id === selectedId && s.path === selectedPath)) {
  console.warn("Selected foreign session is gone; pick again interactively.");
}

Try / catch

try {
  await omp(["--from-claude", "--session", id]);
} catch (err) {
  if (err instanceof SessionResolutionError && err.message.includes("no longer available")) {
    // stale selection: retry interactively
    await omp(["--from-claude"]);
  } else throw err;
}

Prevention

When it happens

Trigger: `--from-<source>` with a previously saved/selected session whose `id` or `path` no longer appears in the freshly listed foreign sessions — typically the foreign session was deleted, or its project directory moved so `path` changed.

Common situations: The Claude/Codex session was cleaned up by that tool's retention; project folder renamed/moved so the recorded cwd path differs; restoring selection from old state after switching machines.

Related errors


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