santifer/career-ops · error
requires a path
Error message
${arg} requires a path What it means
parseCliArgs() in verify-cv-facts.mjs requires that the --source and --config flags be followed by a value. When argv ends with the flag (or the next token is an empty string), it throws '${arg} requires a path'.
Solutions
- Supply the path directly after the flag: --source cv.md --sources config ... i.e. `--source <file>` and `--config <file>`
- Check that any shell variable used for the path is set: echo $SOURCE_PATH
- Reorder so the value follows the flag: node verify-cv-facts.mjs cv.md --source cv.md
Example fix
// before $ node verify-cv-facts.mjs cv.md --source // after $ node verify-cv-facts.mjs cv.md --source sources/cv.md
Defensive patterns
Strategy: validation
Validate before calling
const i = args.indexOf('--source');
if (i !== -1 && (!args[i + 1] || args[i + 1].startsWith('--'))) {
console.error('--source requires a path');
process.exit(2);
} Try / catch
try {
const parsed = parseCliArgs(process.argv.slice(2));
} catch (err) {
if (err.message.includes('requires a path')) {
console.error(`${err.message}\nUsage: verify-cv-facts.mjs <target> --source <file> [--config <file>]`);
process.exit(2);
}
throw err;
} Prevention
- Always put the value immediately after the flag
- Avoid unset shell variables in commands: use "${SRC:?}" to fail fast on empty vars
- Wrap CLI invocations in scripts that assert required arguments first
When it happens
Trigger: Running e.g. `node verify-cv-facts.mjs cv.md --source` or `--config` as the last argument, or with an empty string after it due to shell variable expansion ($SRC unset).
Common situations: Shell variable for the source path is unset/empty so the flag dangles; copy-pasted command truncated before the path; misremembering flag syntax (putting the path before the flag).
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
- --limit must be an integer from 1 to 100
- --months must be an integer from 1 to 120
- unexpected extra positional argument
- unknown option
- unknown option
AI-assisted analysis of santifer/career-ops@e7abd431fc (2026-09-16).
Data as JSON: /api/errors/478d68554e48877f.
Report an issue: GitHub.
Appendix: source
Thrown at verify-cv-facts.mjs:890
const details = [];
if (result.invented.length) details.push(`metric-like claims absent from sources: ${result.invented.join(', ')}`);
if (result.unsupportedFacts.length) details.push(`non-metric facts absent from sources: ${result.unsupportedFacts.map(({ kind, value }) => `${kind}=${value}`).join(', ')}`);
if (result.forbidden.length) details.push(`forbidden phrases found: ${result.forbidden.join(', ')}`);
throw new Error(`Fact check failed${options.label ? ` for ${options.label}` : ''}: ${details.join('; ')}`);
}
return result;
}
/** Parse the fact-validator command-line arguments. */
function parseCliArgs(args) {
const sourcePaths = [];
let targetArg = '';
let configPath = DEFAULT_CONFIG;
let json = false;
for (let i = 0; i < args.length; i++) {
const arg = args[i];
if (arg === '--source' || arg === '--config') {
if (!args[i + 1]) throw new Error(`${arg} requires a path`);
if (arg === '--source') sourcePaths.push(args[++i]);
else configPath = args[++i];
} else if (arg === '--help' || arg === '-h') {
return { help: true };
} else if (arg === '--json') {
json = true;
} else if (arg.startsWith('--')) {
throw new Error(`unknown option: ${arg}`);
} else if (!targetArg) {
targetArg = arg;
} else {
throw new Error(`unexpected extra positional argument: ${arg}`);
}
}
return { targetArg, sourcePaths, configPath, json, help: false };
}
/** Return the command-line usage text. */View on GitHub (pinned to e7abd431fc)