Yeachan-Heo/oh-my-codex · warning

[omx] Failed to reap ${cleanup.failedPids.length} orphaned O

Error message

[omx] Failed to reap ${cleanup.failedPids.length} orphaned OMX MCP process(es); continuing launch.

What it means

Before launch, the CLI attempts to terminate orphaned OMX MCP server processes left over from previous runs. Some of those processes (failedPids) could not be reaped — typically because they belong to another user, are zombies, or kill(2) failed. Launch continues anyway.

Source

Thrown at src/cli/index.ts:6198

      failures.push(error);
    }
  }
  if (failures.length > 0) throw new AggregateError(failures, "preLaunch setup finalization failed");
}

async function completePreLaunchSetup(
  cwd: string,
  sessionId: string,
  notifyTempContract: NotifyTempContract | undefined,
  codexHomeOverride: string | undefined,
  enableNotifyFallbackAuthority: boolean,
  worktreeDirty: boolean,
): Promise<CompletionResult> {
  const degraded: DegradedSetupOperation[] = [];
  try {
    const cleanup = await cleanupLaunchOrphanedMcpProcesses();
    if (cleanup.terminatedCount > 0) console.log(`[omx] Reaped ${cleanup.terminatedCount} orphaned OMX MCP process(es) before launch.`);
    if (cleanup.failedPids.length > 0) console.warn(`[omx] Failed to reap ${cleanup.failedPids.length} orphaned OMX MCP process(es); continuing launch.`);
  } catch (error) {
    degraded.push("orphan-reaping");
    logCliOperationFailure(error);
  }
  let instructions: string;
  try {
    const orchestrationMode = await resolveSessionOrchestrationMode(cwd, sessionId);
    const overlay = await generateOverlay(cwd, sessionId, { orchestrationMode });
    const launchAppendix = await readLaunchAppendInstructions();
    const dirtyWorktreeGuidance = worktreeDirty
      ? `\n\n## Session start: dirty worktree detected\n\nThis worktree has uncommitted changes that were present when the session launched.\nBefore executing the requested task, resolve the dirty state first:\n1. Review uncommitted changes with \`git status\` and \`git diff\`.\n2. Commit, stash, or discard changes as appropriate.\n3. Then proceed with the original task.`
      : "";
    instructions = launchAppendix.trim().length > 0 ? `${overlay}\n\n${launchAppendix}${dirtyWorktreeGuidance}` : `${overlay}${dirtyWorktreeGuidance}`;
  } catch (error) {
    return { kind: "failure", operation: "overlay", error };
  }
  try {
    await writeSessionModelInstructionsFile(cwd, sessionId, instructions);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Inspect and kill the leftover processes manually: `ps aux | grep -i omx` then `kill <pid>`
  2. Ensure the same user account runs omx each time so it can signal its own orphans
  3. Clean stale PID registry files under the omx state directory

Example fix

// before
[omx] Failed to reap 2 orphaned OMX MCP process(es); continuing launch.

// after
pkill -f 'omx.*mcp' ; omx launch
Defensive patterns

Strategy: fallback

Validate before calling

import { existsSync, readFileSync } from 'node:fs';
function staleOrphans(pidFile: string): number[] {
  if (!existsSync(pidFile)) return [];
  return readFileSync(pidFile,'utf8').split('\n').map(Number).filter(Number.isInteger);
}

Prevention

When it happens

Trigger: cleanupLaunchOrphanedMcpProcesses() finds PIDs from a stale registry but process.kill fails for one or more (EPERM, invalid ownership) while terminatedCount or failedPids is non-empty.

Common situations: Running the CLI under a different user than the one that started earlier MCP processes; leftover processes after a crash or forced reboot of the session; containers sharing a PID namespace.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/7fc0f79b067aa0fb. Report an issue: GitHub.