affaan-m/ECC · error · Error
Missing value for --limit
Error message
Missing value for --limit
What it means
In consult.js parseArgs(), when --limit is encountered, the parser checks if argv[index + 1] exists. If it does not (i.e., --limit is the last argument), it throws before even attempting to parse the integer. Note that unlike --target, this check does not reject values starting with '-', so '--limit --target' would pass the existence check but then fail in parsePositiveInteger.
Source
Thrown at scripts/consult.js:220
if (args.includes('--help') || args.includes('-h')) {
parsed.help = true;
return parsed;
}
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === '--json') {
parsed.json = true;
} else if (arg === '--target') {
if (!args[index + 1] || args[index + 1].startsWith('-')) {
throw new Error('Missing value for --target');
}
parsed.target = args[index + 1];
index += 1;
} else if (arg === '--limit') {
if (!args[index + 1]) {
throw new Error('Missing value for --limit');
}
parsed.limit = Math.min(parsePositiveInteger(args[index + 1], '--limit'), MAX_LIMIT);
index += 1;
} else if (arg.startsWith('-')) {
throw new Error(`Unknown argument: ${arg}`);
} else {
parsed.queryParts.push(arg);
}
}
if (!SUPPORTED_INSTALL_TARGETS.includes(parsed.target)) {
throw new Error(
`Unknown install target: ${parsed.target}. Expected one of ${SUPPORTED_INSTALL_TARGETS.join(', ')}`
);
}
parsed.query = parsed.queryParts.join(' ').trim();
return parsed;View on GitHub (pinned to 01e15490f0)
Solutions
- Provide a positive integer immediately after --limit, e.g. --limit 10
- If building commands dynamically, ensure the limit variable is set before appending --limit
- Omit --limit entirely to use the default of 5
Example fix
// before node scripts/consult.js security --limit // after node scripts/consult.js security --limit 10
Defensive patterns
Strategy: validation
Validate before calling
// Verify --limit has a following value before invoking consult.js
const argv = process.argv.slice(2);
const limitIdx = argv.indexOf('--limit');
if (limitIdx !== -1 && !argv[limitIdx + 1]) {
console.error('Missing value for --limit. Provide a positive integer.');
process.exit(1);
} Try / catch
try {
const options = parseArgs(process.argv);
} catch (error) {
if (error.message === 'Missing value for --limit') {
console.error('Provide a positive integer after --limit, e.g. --limit 5');
process.exit(2);
}
throw error;
} Prevention
- Always place the integer value immediately after --limit
- Omit --limit to use the default of 5 if you are unsure
- In dynamic command builders, ensure the limit variable is truthy before appending the flag
When it happens
Trigger: Passing --limit as the last argument on the command line; a wrapper script that conditionally appends --limit but forgets the value.
Common situations: Dynamic command construction in Makefiles or CI YAML where the limit variable is empty; copy-paste from partial documentation.
Related errors
- ${label} must be a positive integer
- Missing value for --target
- Unknown argument: ${arg}
- Unknown install target: ${parsed.target}. Expected one of ${
- --write requires a path
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/027cf0be5de5c3d1.
Report an issue: GitHub.