pbakaus/impeccable · error
--target requires a path value
Error message
--target requires a path value (use --target <path> or --target=<path>)
What it means
consumeTargetArg() (skill/scripts/live/roots.mjs) strips '--target <path>' from a live helper's argv (mutating it via splice) and returns the value so the helper operates on an explicit app root. In the separate-token form, it throws — unconditionally, there is no non-strict mode — when '--target' is the last token, or the next token is not a usable string (empty, or itself starting with '--'). The guard is deliberate: these helpers mutate session state, and a valueless --target must not degrade into implicit 'most recent app' root selection.
Solutions
- Pass the value attached to the flag: --target /path/to/app or --target=/path/to/app
- Guard optional targeting in scripts: only add the pair when non-empty — [[ -n "$TARGET" ]] && set -- --target "$TARGET" "$@"
- Drop --target entirely when operating on the implicitly selected root is acceptable
Example fix
# before node live-commit-manual-edits.mjs --target # after node live-commit-manual-edits.mjs --target /path/to/app
Defensive patterns
Strategy: validation
Validate before calling
function validateTargetArg(argv) {
const i = argv.indexOf('--target');
if (i === -1) return true;
const value = argv[i + 1];
return typeof value === 'string' && value !== '' && !value.startsWith('--');
}
if (!validateTargetArg(process.argv)) {
console.error('--target requires a path value (use --target <path> or --target=<path>)');
process.exit(2);
} Try / catch
let target;
try {
target = consumeTargetArg(process.argv);
} catch (err) {
if (err?.message?.includes('--target requires a path value')) {
printUsageAndExit(2);
}
throw err;
} Prevention
- Emit flag and value as an inseparable pair in wrappers: args.push('--target', target) only after the non-empty check
- Shell guards: [[ -n "$TARGET" ]] && set -- --target "$TARGET" "$@"
- Remember this helper throws always (no lenient mode) because a valueless --target must not fall back to implicit root selection
When it happens
Trigger: Invoking a live helper (e.g. live-commit-manual-edits.mjs) with '--target' as the final argument; '--target --verbose' where the intended value was forgotten and the next token parses as a flag; '--target ""' from an unset or empty shell variable.
Common situations: Shell scripts appending --target conditionally while the value lands in a different branch; quoting/continuation-line mistakes splitting flag from value; variable empty due to a typo in its name.
Related errors
- {}
- Unsupported live copy-edit AI runner
- Aborted.
- ambiguous snapshot slug; use an explicit ./path or remove…
- requires a glob
AI-assisted analysis of pbakaus/impeccable@f88b2837a7 (2026-08-18).
Data as JSON: /api/errors/aeccb7d4c798d70e.
Report an issue: GitHub.
Appendix: source
Thrown at skill/scripts/live/roots.mjs:451
if (fresh.selection) return { selection: fresh.selection, source: 'fresh' };
return { manifest: fresh.manifest, source: 'fresh' };
}
/**
* Consume a `--target <path>` / `--target=<path>` pair from an argv array,
* returning the value and removing the tokens so downstream flag parsers
* (which do not know the option) never see them.
*/
export function consumeTargetArg(argv = process.argv) {
for (let i = 0; i < argv.length; i++) {
const arg = argv[i];
if (arg === '--target') {
const value = argv[i + 1];
// A --target with no usable value must not degrade into implicit root
// selection: these helpers mutate session state, and "the most recent
// app" is exactly what the caller was trying NOT to get.
if (typeof value !== 'string' || value === '' || value.startsWith('--')) {
throw new Error('--target requires a path value (use --target <path> or --target=<path>)');
}
argv.splice(i, 2);
return value;
}
if (typeof arg === 'string' && arg.startsWith('--target=')) {
const value = arg.slice('--target='.length);
if (value === '') {
throw new Error('--target requires a path value (use --target <path> or --target=<path>)');
}
argv.splice(i, 1);
return value;
}
}
return null;
}
/**
* Entry-point guard for live CLI scripts: resolve the governing roots andView on GitHub (pinned to f88b2837a7)