Yeachan-Heo/oh-my-codex · error
Missing path value after --input-file
Error message
Missing path value after --input-file
What it means
The --input-file flag was the last token: no path followed it, so the state command cannot read the JSON file. This mirrors the --input check for the file-based variant.
Source
Thrown at src/cli/state.ts:117
continue;
}
if (arg === '--input') {
const next = args[index + 1];
if (!next) {
throw new Error('Missing JSON value after --input');
}
inputValue = next;
index += 1;
continue;
}
if (arg.startsWith('--input=')) {
inputValue = arg.slice('--input='.length);
continue;
}
if (arg === '--input-file') {
const next = args[index + 1];
if (!next) {
throw new Error('Missing path value after --input-file');
}
inputFileValue = next;
index += 1;
continue;
}
if (arg.startsWith('--input-file=')) {
inputFileValue = arg.slice('--input-file='.length);
continue;
}
if (arg === '--mode') {
const next = args[index + 1];
if (!next) {
throw new Error('Missing value after --mode');
}
modeValue = next;
index += 1;
continue;
}View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Supply the path: `state set --input-file ./state.json`
- Check the variable is set and the file exists before running: `[ -f "$F" ] || exit 1`
Example fix
# before state set --input-file # $F unset # after F=./state.json state set --input-file "$F"
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'node:fs';
if (!file || !existsSync(file)) throw new Error(`input file missing: ${file}`);
spawn('state', ['set', '--input-file', file]); Prevention
- Assert `[ -f "$F" ]` before building the command
- Prefer --input-file over --input to dodge shell quoting issues
When it happens
Trigger: `state set --input-file` at end of args, e.g. `state set --input-file "$PATH_TO_JSON"` with an unset variable.
Common situations: Unset environment variables expanding to nothing; script loops generating the command with an empty filename on the last iteration.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- Missing JSON value after --input
- --keep-policy must be one of: score_improvement, pass_only
- Unknown capabilities subcommand: ${parsed.subcommand}
- Unknown capabilities option: ${arg}
- ${flag} requires a value
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/b59f083e3048001e.
Report an issue: GitHub.