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

Missing value after --codex-home.

Error message

Missing value after --codex-home.

What it means

--codex-home requires a path value as the next token. Thrown when --codex-home is last in omxArgs or the next token starts with `-`.

Source

Thrown at src/cli/index.ts:1258

export interface ResumeCodexHomeSelection {
  args: string[];
  explicitCodexHome?: string;
  projectOnly: boolean;
}

export function parseResumeCodexHomeSelection(args: string[]): ResumeCodexHomeSelection {
  const { omxArgs, suffix } = splitOmxArgsAtEndOfOptions(args);
  const nextArgs: string[] = [];
  let explicitCodexHome: string | undefined;
  let projectOnly = false;

  for (let index = 0; index < omxArgs.length; index += 1) {
    const arg = omxArgs[index];
    if (arg === "--codex-home") {
      const value = omxArgs[index + 1];
      if (!value || value.startsWith("-")) {
        throw new Error("Missing value after --codex-home.");
      }
      explicitCodexHome = value;
      index += 1;
      continue;
    }
    if (arg.startsWith("--codex-home=")) {
      explicitCodexHome = arg.slice("--codex-home=".length);
      if (explicitCodexHome.trim() === "") {
        throw new Error("Missing value after --codex-home.");
      }
      continue;
    }
    if (arg === "--project") {
      projectOnly = true;
      continue;
    }
    nextArgs.push(arg);
  }

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Append the path: `--codex-home /custom/path`
  2. Use `--codex-home=/custom/path` inline form
  3. Ensure the variable holding the path is non-empty

Example fix

# before
omx --codex-home "$CODEX_HOME"
# after
CODEX_HOME=${CODEX_HOME:-$HOME/.codex} omx --codex-home="$CODEX_HOME"
Defensive patterns

Strategy: validation

Validate before calling

const i = args.indexOf('--codex-home');
const v = args[i + 1];
if (!v || v.startsWith('-')) throw new Error('missing --codex-home value');

Type guard

const isNonFlagValue = (v: string | undefined): v is string => !!v && !v.startsWith('-') && v.trim() !== '';

Prevention

When it happens

Trigger: `omx --codex-home` at end of args, or `--codex-home --project`.

Common situations: Scripts passing an unset env var that expands to empty; quoting mistakes.

Related errors


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