affaan-m/ECC · error · Error
requires a value
Error message
${flagName} requires a value What it means
readValue in observability-readiness.js fetches the value following a value-taking flag (e.g. --root, --format). If the next token is absent or looks like another flag (starts with '--'), it throws this error rather than silently consuming a flag as a value.
Solutions
- Supply the value directly after the flag: `--format json`, `--root ./docs`.
- Reorder arguments so value-taking flags are followed by their values, not other flags.
- Guard shell variables: `--root "${ROOT:?ROOT not set}"`.
- For --format, use the literal values text or json.
Example fix
// before node scripts/observability-readiness.js --format --json // after node scripts/observability-readiness.js --format json
Defensive patterns
Strategy: validation
Validate before calling
const i = args.indexOf('--format');
if (i !== -1 && (!args[i+1] || args[i+1].startsWith('--'))) throw new Error('--format needs a value immediately after it'); Try / catch
try {
runObservability(argv);
} catch (err) {
if (err.message.endsWith('requires a value')) {
console.error('Provide the flag value immediately after the flag name.');
} else throw err;
} Prevention
- Place values immediately after value-taking flags.
- Don't place value flags at the end of the command line.
- Use "${VAR:?not set}" guards for interpolated values.
- Prefer the = syntax (e.g. --root=docs) where supported to bind value and flag.
When it happens
Trigger: Running the script with `--format` as the last argument, or `--format --json` where the value slot is filled by another flag; any value-bearing flag immediately followed by another flag or end of argv.
Common situations: Shell variables expanding to empty strings before a flag value; copy-paste dropping the value; reordering CLI flags so a value flag sits last; empty config variable interpolation like `--root $ROOT` with ROOT unset.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- requires a value
- Missing value for --install-dir.
- An executable is required after --.
- An install config path is required
- At least one --target is required for handoffs.
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/b9f744cb082df292.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/observability-readiness.js:25
const RUBRIC_VERSION = '2026-05-11';
function usage() {
console.log([
'Usage: node scripts/observability-readiness.js [--format <text|json>] [--root <dir>]',
'',
'Deterministic ECC 2.0 observability readiness gate.',
'',
'Options:',
' --format <text|json> Output format (default: text)',
' --root <dir> Repository root to inspect (default: cwd)',
' --help, -h Show this help'
].join('\n'));
}
function readValue(args, index, flagName) {
const value = args[index + 1];
if (!value || value.startsWith('--')) {
throw new Error(`${flagName} requires a value`);
}
return value;
}
function parseArgs(argv) {
const args = argv.slice(2);
const parsed = {
format: 'text',
help: false,
root: path.resolve(process.cwd())
};
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === '--help' || arg === '-h') {
parsed.help = true;
continue;View on GitHub (pinned to 8321021c54)