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

Missing value after --actor

Error message

Missing value after --actor

What it means

Usage error from parseExecInjectArgs when `--actor` is the last token with no following value. The parser reads the next token as the actor name and throws when there is none.

Source

Thrown at src/exec/followup.ts:390

    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);
    } else if (!arg.startsWith("-") && !prompt) {
      prompt = [arg, ...rest.slice(i + 1)].join(" ");
      break;
    } else {
      throw new Error(`Unknown exec inject argument: ${arg}`);
    }
  }
  return { sessionId, prompt, actor, json };
}

function readFileSyncForCli(path: string): string {
  return readFileSync(path, "utf-8");
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Provide the actor: `--actor ci-bot` or `--actor=ci-bot`.
  2. Default the variable first: `--actor "${ACTOR:-ci-bot}"`.
  3. Use the --actor= form to make value pairing explicit.
  4. Note --actor is optional; omit it entirely to fall back to $USER/$USERNAME or 'unknown'.

Example fix

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

# after
omx exec inject "$SESSION_ID" --prompt "hi" --actor "${ACTOR:-ci-bot}"
Defensive patterns

Strategy: validation

Validate before calling

const actor = process.env.ACTOR?.trim() || 'ci-bot';
runCli(['exec', 'inject', sessionId, '--prompt', text, '--actor', actor]);

Try / catch

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

Prevention

When it happens

Trigger: Ending the command with a bare `--actor`; passing `--actor "$USER_NAME"` where the variable is empty in strict-arg scripts; shell quoting consuming the following token.

Common situations: Actor name sourced from an env var unset in CI (e.g. no USER/CI_USER set); copied command trimmed of its value; multiline CI command where the value line was dropped.

Related errors


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