affaan-m/ECC · error · Error
Unknown argument: ${arg}
Error message
Unknown argument: ${arg} What it means
Thrown by scripts/work-items.js parseArgs when a token starts with '-' but is not --help, -h, --json, and not a member of VALUE_FLAGS. Any hyphen-prefixed token that is not a recognized option is rejected; bare positional tokens (like a subcommand or an id) are accepted into positionals and do not trigger this. This is the work-items counterpart of the unknown-argument guard in status.js and uninstall.js.
Source
Thrown at scripts/work-items.js:114
}
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else if (arg === '--json') {
parsed.json = true;
} else if (VALUE_FLAGS.has(arg)) {
const value = args[index + 1];
if (!value || value.startsWith('--')) {
throw new Error(`Missing value for ${arg}`);
}
assignOption(parsed, arg, value);
index += 1;
} else if (!arg.startsWith('-')) {
parsed.positionals.push(arg);
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
return parsed;
}
function parseMetadataJson(value) {
if (value === undefined || value === null) {
return null;
}
try {
return JSON.parse(value);
} catch (error) {
throw new Error(`Invalid --metadata-json: ${error.message}`);
}
}
View on GitHub (pinned to 01e15490f0)
Solutions
- Run `node scripts/work-items.js --help` to see the accepted flags per subcommand.
- Correct the flag spelling or remove the unsupported option.
- Confirm the flag belongs to work-items.js and not to a sibling script (status.js, uninstall.js).
Example fix
// before node scripts/work-items.js list --verbose // after node scripts/work-items.js list --json
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN = new Set(['--help','-h','--json','--as','--db','--github-repo','--id','--limit','--metadata-json','--owner','--priority','--repo','--repo-root','--session','--session-id','--source','--source-id','--status','--title','--url']);
function validateWorkItemsArgs(argv) {
for (const tok of argv) {
if (tok.startsWith('-') && !KNOWN.has(tok)) {
throw new Error(`work-items.js does not accept: ${tok}`);
}
}
} Prevention
- Run `node scripts/work-items.js --help` to enumerate valid flags per subcommand.
- Do not reuse flags from status.js/uninstall.js on work-items.js without checking.
- Validate assembled argv in a helper before spawning the process.
When it happens
Trigger: `node scripts/work-items.js list --verbose`; `node scripts/work-items.js upsert --description "x"` (--description is not a supported flag); `--json-output` (correct is --json).
Common situations: Typos in flag names; passing a flag from another ECC script that work-items does not support; a version mismatch where a flag was renamed; assuming a generic flag like --verbose exists.
Related errors
- Missing value for ${arg}
- ${label} must be a positive integer
- Unknown install target: ${parsed.target}. Expected one of ${
- Invalid ${flagName}: ${value}
- Invalid format: ${parsed.format}. Use text, json, or markdow
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/8528e0cd138ece84.
Report an issue: GitHub.