Yeachan-Heo/oh-my-codex · warning · Error
Missing path after --prompt-file
Error message
Missing path after --prompt-file
What it means
Usage error from parseExecInjectArgs when `--prompt-file` appears as the final token and no path follows. The parser expects the next argument to be a file path to read the prompt from and throws when it is absent.
Source
Thrown at src/exec/followup.ts:383
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);
} else if (!arg.startsWith("-") && !prompt) {
prompt = [arg, ...rest.slice(i + 1)].join(" ");
break;
} else {
throw new Error(`Unknown exec inject argument: ${arg}`);
}
}View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Provide the path: `--prompt-file ./prompt.txt` or `--prompt-file=./prompt.txt`.
- Assert the variable/file first: `[ -f "$PROMPT_FILE" ] || { echo "missing prompt file"; exit 1; }`.
- Use the --prompt-file= form for explicitness.
- If the file content may be empty, remember the prompt still must be non-empty after read or error missing_prompt applies.
Example fix
# before omx exec inject "$SESSION_ID" --prompt-file # after omx exec inject "$SESSION_ID" --prompt-file ./followup-prompt.txt
Defensive patterns
Strategy: validation
Validate before calling
if (!promptFile || !existsSync(promptFile)) throw new Error('prompt file path required and must exist');
runCli(['exec', 'inject', sessionId, '--prompt-file', promptFile]); Try / catch
catch (e) { if (e instanceof Error && e.message === 'Missing path after --prompt-file') { console.error('usage: --prompt-file <path>'); process.exit(2); } throw e; } Prevention
- Validate the file path variable and file existence before invoking.
- Use --prompt-file=path form to avoid token-splitting issues.
When it happens
Trigger: Ending the command with a bare `--prompt-file`; a script passing `--prompt-file "$FILE"` where FILE is unset so no token follows; the path being consumed by an earlier flag leaving --prompt-file valueless.
Common situations: Prompt file path stored in an unset variable; CI step references an artifact path that wasn't produced; typo where the path is on the wrong side of a line continuation.
Related errors
- Usage: omx exec inject <session-id> --prompt <text> [--actor
- Missing value after --prompt
- Missing value after --actor
- Unknown exec inject argument: ${arg}
- Unknown adapt argument: ${arg}
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/f3c4393d2288cd3e.
Report an issue: GitHub.