Yeachan-Heo/oh-my-codex · error · Error

Invalid OMX_TEAM_WORKER_LAUNCH_MODE value

Error message

Invalid OMX_TEAM_WORKER_LAUNCH_MODE value "${raw}". Expected: interactive, prompt

What it means

The OMX_TEAM_WORKER_LAUNCH_MODE environment variable was set to a value other than 'interactive' or 'prompt' (empty/unset defaults to interactive). Thrown by resolveWorkerLaunchModeFromEnv when resolving team policy.

Solutions

  1. Set the variable to exactly 'interactive' or 'prompt', or unset it entirely
  2. Check for typos, whitespace, and casing in .env / CI environment definitions
  3. Document allowed values wherever the variable is configured (deployment manifests)

Example fix

# before
export OMX_TEAM_WORKER_LAUNCH_MODE=headless

# after
export OMX_TEAM_WORKER_LAUNCH_MODE=prompt  # or unset for interactive
Defensive patterns

Strategy: validation

Validate before calling

const VALID_MODES = new Set(['interactive', 'prompt']);
function launchModeValid(raw: string | undefined): boolean {
  return raw === undefined || raw === '' || VALID_MODES.has(raw);
}

Type guard

function isValidLaunchMode(v: string): v is 'interactive' | 'prompt' {
  return v === 'interactive' || v === 'prompt';
}

Try / catch

catch (e) {
  const m = /Invalid OMX_TEAM_WORKER_LAUNCH_MODE value "(.*)"/.exec(String((e as Error).message));
  if (m) { delete process.env.OMX_TEAM_WORKER_LAUNCH_MODE; /* default interactive */ return retry(); }
  throw e;
}

Prevention

When it happens

Trigger: Setting OMX_TEAM_WORKER_LAUNCH_MODE to e.g. 'headless', 'auto', 'Interactive' (case-sensitive), or any other string, then loading team policy/worker launch mode.

Common situations: Copy-pasted config from other tools with different mode names; typo or trailing whitespace in .env files; case mismatch; CI setting an unsupported mode after an upgrade changed allowed values.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


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

Appendix: source

Thrown at src/team/state.ts:623

  if (['1', 'true', 'yes', 'on', 'enabled', 'allow', 'allowed'].includes(normalized)) return true;
  if (['0', 'false', 'no', 'off', 'disabled', 'deny', 'denied'].includes(normalized)) return false;
  return null;
}

function resolveDisplayModeFromEnv(env: NodeJS.ProcessEnv): TeamPolicy['display_mode'] {
  const raw = readEnvValue(env, ['OMX_TEAM_DISPLAY_MODE', 'OMX_TEAM_MODE']);
  if (!raw) return 'auto';
  if (raw === 'in_process' || raw === 'in-process') return 'split_pane';
  if (raw === 'split_pane' || raw === 'tmux') return 'split_pane';
  if (raw === 'auto') return 'auto';
  return 'auto';
}

function resolveWorkerLaunchModeFromEnv(env: NodeJS.ProcessEnv): TeamPolicy['worker_launch_mode'] {
  const raw = readEnvValue(env, ['OMX_TEAM_WORKER_LAUNCH_MODE']);
  if (!raw || raw === 'interactive') return 'interactive';
  if (raw === 'prompt') return 'prompt';
  throw new Error(`Invalid OMX_TEAM_WORKER_LAUNCH_MODE value "${raw}". Expected: interactive, prompt`);
}

function resolvePermissionsSnapshot(env: NodeJS.ProcessEnv): PermissionsSnapshot {
  const snapshot = defaultPermissionsSnapshot();

  const approvalMode = readEnvValue(env, [
    'OMX_APPROVAL_MODE',
    'CODEX_APPROVAL_MODE',
    'CODEX_APPROVAL_POLICY',
    'CLAUDE_CODE_APPROVAL_MODE',
  ]);
  if (approvalMode) snapshot.approval_mode = approvalMode;

  const sandboxMode = readEnvValue(env, ['OMX_SANDBOX_MODE', 'CODEX_SANDBOX_MODE', 'SANDBOX_MODE']);
  if (sandboxMode) snapshot.sandbox_mode = sandboxMode;

  const network = parseOptionalBoolean(readEnvValue(env, ['OMX_NETWORK_ACCESS', 'CODEX_NETWORK_ACCESS', 'NETWORK_ACCESS']));
  if (network !== null) snapshot.network_access = network;

View on GitHub (pinned to 3ad79a8a6f)