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
- Supply the value inline: `--prompt "<text>"` or `--prompt=<text>`.
- If the value comes from a variable, default or assert it first: `: "${MSG:?MSG is required}"`.
- Use the --prompt= form to make the pairing explicit and resistant to token splitting.
- 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
- Prefer the --prompt=value form in scripts.
- Assert prompt variables are non-empty before building the command line.
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
- Missing value after --actor
- Missing value for ${flag}.
- Usage: omx exec inject <session-id> --prompt <text> [--actor
- Missing path after --prompt-file
- Unknown exec inject argument: ${arg}
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/e3b6f6501a4ea766.
Report an issue: GitHub.