affaan-m/ECC · error · Error
requires a value.
Error message
${argument} requires a value. What it means
scripts/memory.js's parseArgs recognizes certain options as value-taking (VALUE_OPTIONS) or repeatable (REPEAT_OPTIONS). For these, the next argv element must exist and must not look like another flag (start with '--'). If the value is missing or is itself a flag, the parser throws '<argument> requires a value.' to prevent silently consuming the wrong token.
Solutions
- Provide the value directly after the flag: `--content "my note"`.
- If the value itself starts with '--', quote it or use `--content=--value` style if supported by your wrapper.
- Check that shell quoting preserved the value (e.g. `--content $EMPTY_VAR` yields nothing if the variable is unset).
- Run the command with the intended value first in your shell history review to spot dropped tokens.
Example fix
// before node scripts/memory.js write --content // after node scripts/memory.js write --content "project decision: use Redis"
Defensive patterns
Strategy: validation
Validate before calling
const idx = args.indexOf('--content');
if (idx !== -1 && (args[idx+1] === undefined || args[idx+1].startsWith('--'))) {
throw new Error('--content requires a value');
} Try / catch
try { run(args); } catch (e) { if (e.message.includes('requires a value')) { console.error(`${e.message} Pass the value right after the flag.`); process.exitCode = 2; } else throw e; } Prevention
- Always quote option values in shell scripts
- Check for unset shell variables that would expand to nothing
- Keep flag-value pairs together when building argv arrays programmatically
When it happens
Trigger: Running `node scripts/memory.js write --content` (nothing after the flag) or `node scripts/memory.js write --content --tags a,b` (next token is a flag).
Common situations: Forgetting the value at the end of a command line, intending a value that starts with '--', or quoting mistakes that split the value into multiple tokens.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/294a224a66a6e2ed.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/memory.js:110
return { command: 'help', options: {}, positionals: [] };
}
const [command, ...args] = argv;
const parsed = args.reduce((state, argument, index) => {
if (state.skipNext) {
return { ...state, skipNext: false };
}
if (BOOLEAN_OPTIONS.has(argument)) {
return {
...state,
options: { ...state.options, [BOOLEAN_OPTIONS.get(argument)]: true },
};
}
const valueKey = VALUE_OPTIONS.get(argument);
const repeatKey = REPEAT_OPTIONS.get(argument);
if (valueKey || repeatKey) {
const value = args[index + 1];
if (value === undefined || value.startsWith('--')) {
throw new Error(`${argument} requires a value.`);
}
return {
...state,
options: repeatKey
? appendOption(state.options, repeatKey, value)
: { ...state.options, [valueKey]: value },
skipNext: true,
};
}
if (argument.startsWith('-')) {
throw new Error(`Unknown option: ${argument}`);
}
return { ...state, positionals: [...state.positionals, argument] };
}, { options: {}, positionals: [], skipNext: false });
return {
command,
options: parsed.options,View on GitHub (pinned to 8321021c54)