affaan-m/ECC · warning · Error
${argument} requires a value.
Error message
${argument} requires a value. What it means
In memory.js parseArgs, any flag in VALUE_OPTIONS (--body-file, --from, --limit, --source-harness, --target-harness, --title) or REPEAT_OPTIONS (--kind, --link, --scope, --tag, --target) must be followed by a value token. If the next token is undefined (end of args) or starts with '--' (looks like another flag), the parser throws `${argument} requires a value.` The guard prevents consuming the next flag as a value.
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 01e15490f0)
Solutions
- Provide a value after each value/repeat flag.
- Quote values containing special characters: `--title "Release 2025-08"`.
- If a shell variable may be empty, default it: `--title "${TITLE:?title required}"`.
- Run `memory` with no args / --help to see which flags need values.
Example fix
# before ecc memory save --title --body-file notes.md # after ecc memory save --title "Release notes" --body-file notes.md
Defensive patterns
Strategy: validation
Validate before calling
const VALUE_OR_REPEAT = new Set(['--body-file','--from','--limit','--source-harness','--target-harness','--title','--kind','--link','--scope','--tag','--target']);
function assertMemoryValuesPresent(argv) {
for (let i = 0; i < argv.length; i++) {
if (VALUE_OR_REPEAT.has(argv[i])) {
const next = argv[i + 1];
if (next === undefined || next.startsWith('--')) throw new Error(`${argv[i]} requires a value.`);
}
}
} Try / catch
try { parseArgs(process.argv); }
catch (err) { if (/requires a value\./.test(err.message)) { console.error(err.message); usage(2); } else throw err; } Prevention
- Quote values, especially ones containing spaces or punctuation.
- Use `${VAR:?msg}` so empty shell variables fail early.
- Run `ecc memory` with no args to see which flags require values.
When it happens
Trigger: Ending the command with a value flag: `memory save --title`. Placing two value flags back to back: `memory save --title --body-file x.md`. A negative-style value the user forgot to quote that the parser sees as flag-like.
Common situations: Editing a long memory command and dropping a value. Scripted invocation where a variable expanded to empty, so the flag is followed by the next flag.
Related errors
- Unknown option: ${argument}
- ${command} does not accept positional arguments.
- ${label} may be provided only once.
- Unknown argument: ${arg}
- ${flagName} requires a value
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/294a224a66a6e2ed.
Report an issue: GitHub.