can1357/oh-my-pi · error · SessionResolutionError

--from-claude and --from-codex cannot be used together

Error message

--from-claude and --from-codex cannot be used together

What it means

resolveForeignSessionSource validates CLI flag combinations for importing sessions from foreign tools. --from-claude (import Claude Code sessions) and --from-codex (import Codex sessions) are mutually exclusive source selectors, so passing both throws a SessionResolutionError before any session resolution happens.

Source

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

 * session-resolution flags (`--resume`/`--fork`/missing-directory move prompts)
 * cannot be satisfied. {@link runRootCommand} catches it and prints a clean
 * stderr message instead of letting it surface as `[Uncaught Exception]`
 * (see issue #2084).
 */
export class SessionResolutionError extends Error {
	readonly hint?: string;
	constructor(message: string, hint?: string) {
		super(message);
		this.name = "SessionResolutionError";
		this.hint = hint;
	}
}

function resolveForeignSessionSource(
	parsed: Pick<Args, "continue" | "fork" | "fromClaude" | "fromCodex" | "noSession" | "resume">,
): ForeignSessionSource | undefined {
	if (parsed.fromClaude && parsed.fromCodex) {
		throw new SessionResolutionError("--from-claude and --from-codex cannot be used together");
	}
	const source = parsed.fromClaude ? "claude" : parsed.fromCodex ? "codex" : undefined;
	if (!source) return undefined;
	if (parsed.noSession) {
		throw new SessionResolutionError(`--from-${source} requires session persistence`);
	}
	if (parsed.continue || parsed.resume || parsed.fork) {
		throw new SessionResolutionError(`--from-${source} cannot be combined with --continue, --resume, or --fork`);
	}
	return source;
}

function isForeignSessionImport(parsed: Pick<Args, "fromClaude" | "fromCodex">): boolean {
	return parsed.fromClaude === true || parsed.fromCodex === true;
}

type MissingCwdMoveResult =
	| { status: "not-needed" }

View on GitHub (pinned to 9690622007)

Solutions

  1. Keep only one of --from-claude or --from-codex in the command.
  2. Check shell aliases/functions for a hardcoded --from-* flag that duplicates your explicit one.

Example fix

// before
omp --from-claude --from-codex
// after
omp --from-claude
Defensive patterns

Strategy: validation

Validate before calling

const flags = process.argv.slice(2);
if (flags.includes("--from-claude") && flags.includes("--from-codex"))
  throw new Error("Pick one import source: --from-claude OR --from-codex");

Prevention

When it happens

Trigger: Invoking omp with both --from-claude and --from-codex on the same command line (or both present in a parsed args object passed to resolveForeignSessionSource).

Common situations: Aliased shell functions that append a default --from-* flag while the user supplies the other; scripted invocation building flags from two config sources; misunderstanding that both imports would be merged.

Related errors


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