Yeachan-Heo/oh-my-codex · warning

Missing value after --prompt

Error message

Missing value after --prompt

What it means

Usage error from parseExecInjectArgs when `--prompt` is the last token of the command line, so there is no following value to consume. The parser reads rest[i+1] after seeing --prompt and throws when it is undefined.

Source

Thrown at src/exec/followup.ts:376

  sessionId: string;
  prompt: string;
  actor?: string;
  json: boolean;
} {
  const [, sessionIdRaw, ...rest] = args;
  const sessionId = sessionIdRaw?.trim();
  if (!sessionId) throw new Error("Usage: omx exec inject <session-id> --prompt <text> [--actor <name>] [--json]");

  let prompt = "";
  let actor: string | undefined;
  let json = false;
  for (let i = 0; i < rest.length; i += 1) {
    const arg = rest[i]!;
    if (arg === "--json") {
      json = true;
    } else if (arg === "--prompt") {
      const value = rest[i + 1];
      if (!value) throw new Error("Missing value after --prompt");
      prompt = value;
      i += 1;
    } else if (arg.startsWith("--prompt=")) {
      prompt = arg.slice("--prompt=".length);
    } else if (arg === "--prompt-file") {
      const value = rest[i + 1];
      if (!value) throw new Error("Missing path after --prompt-file");
      prompt = readFileSyncForCli(value);
      i += 1;
    } else if (arg.startsWith("--prompt-file=")) {
      prompt = readFileSyncForCli(arg.slice("--prompt-file=".length));
    } else if (arg === "--actor") {
      const value = rest[i + 1];
      if (!value) throw new Error("Missing value after --actor");
      actor = value;
      i += 1;
    } else if (arg.startsWith("--actor=")) {
      actor = arg.slice("--actor=".length);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Supply the value inline: `--prompt "<text>"` or `--prompt=<text>`.
  2. If the value comes from a variable, default or assert it first: `: "${MSG:?MSG is required}"`.
  3. Use the --prompt= form to make the pairing explicit and resistant to token splitting.
  4. For long prompts use --prompt-file <path> instead.

Example fix

# before
omx exec inject "$SESSION_ID" --prompt

# after
omx exec inject "$SESSION_ID" --prompt "rerun the flaky suite"
Defensive patterns

Strategy: validation

Validate before calling

const args = ['--prompt'];
if (!text) throw new Error('prompt text required');
args.push(text);

Try / catch

catch (e) { if (e instanceof Error && e.message === 'Missing value after --prompt') { console.error('provide --prompt <text> or --prompt=<text>'); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: Ending the command with a bare `--prompt` (e.g. `omx exec inject <id> --prompt`); a shell variable that expands to empty making the next token disappear; line-continuation backslash mistakes that drop the value.

Common situations: Prompt text intended from an unset env var (`--prompt "$MSG"` where MSG is empty expands to a missing value in some shells/scripts); trailing flag typo; CI YAML folds the value onto a missing line; user edits a copied command and deletes the text.

Related errors


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