affaan-m/ECC · error · Error
Missing value for ${arg}
Error message
Missing value for ${arg} What it means
Thrown by scripts/work-items.js parseArgs when a VALUE_FLAGS member (e.g. --id, --title, --limit, --owner, --db, etc.) is passed but the next token is missing or itself starts with '--'. The guard `if (!value || value.startsWith('--'))` prevents one flag from silently consuming the next flag's name as its value. Each value flag requires a concrete argument.
Source
Thrown at scripts/work-items.js:107
json: false,
limit: 20,
positionals: []
};
if (args[0] && !args[0].startsWith('-')) {
parsed.command = args.shift();
}
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;
}
View on GitHub (pinned to 01e15490f0)
Solutions
- Provide a non-flag value immediately after the flag: `--title "Ship feature X"`.
- If the value would legitimately be empty, omit the flag rather than passing it empty.
- Reorder so the value flag is not immediately followed by another flag.
Example fix
// before node scripts/work-items.js upsert --title // after node scripts/work-items.js upsert --title "Ship feature X"
Defensive patterns
Strategy: validation
Validate before calling
const VALUE_FLAGS = new Set(['--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 (let i = 0; i < argv.length; i++) {
const tok = argv[i];
if (VALUE_FLAGS.has(tok)) {
const val = argv[i + 1];
if (!val || val.startsWith('--')) {
throw new Error(`Flag ${tok} requires a value`);
}
i += 1;
}
}
} Prevention
- Always provide a concrete value immediately after a value flag.
- Do not let two value flags sit adjacent without values between them.
- Construct work-items argv with a helper that pairs each value flag with its value.
When it happens
Trigger: `node scripts/work-items.js upsert --title` (no title text); `node scripts/work-items.js claim --owner` (no owner name); `node scripts/work-items.js list --limit --json` (--limit immediately followed by --json).
Common situations: A wrapper script interpolating an empty variable into a flag value; reordering flags so a value flag lands last; passing a flag whose value legitimately could start with '--' is intentionally rejected to avoid ambiguity.
Related errors
- Unknown argument: ${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/d7ef6266f3f300b2.
Report an issue: GitHub.