affaan-m/ECC · error · Error

${flagName} requires a value

Error message

${flagName} requires a value

What it means

Thrown by readValue in scripts/observability-readiness.js when a value-taking flag (`--format`, `--root`) is the last token or is immediately followed by another flag (a token starting with `--`). The CLI parses flags manually and treats a missing or flag-like next token as 'no value supplied'.

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 01e15490f0)

Solutions

  1. Supply the value right after the flag: `--format json`.
  2. Use the equals form to avoid the adjacency problem: `--format=json`.
  3. Quote shell variables so an empty expansion is visible and you can detect it before invocation.

Example fix

// before
node scripts/observability-readiness.js --format --root .
// after
node scripts/observability-readiness.js --format json --root .
Defensive patterns

Strategy: validation

Validate before calling

function pairFlagsAndValues(argv) {
  const valueFlags = new Set(['--format', '--root']);
  for (let i = 0; i < argv.length; i++) {
    if (valueFlags.has(argv[i])) {
      const next = argv[i + 1];
      if (!next || next.startsWith('--')) {
        throw new Error(`${argv[i]} needs a value; pass '--${argv[i].slice(2)}=value' or add the value`);
      }
    }
  }
}

Prevention

When it happens

Trigger: Running `node scripts/observability-readiness.js --format` at end of line, or `--format --root .` where `--format` is followed by another flag. Only the space-separated forms (`--format text`) go through readValue; the `--format=text` equals-form parses inline and never hits this.

Common situations: Truncated command lines from copy-paste; a shell variable for the value that expanded to empty; ordering flags such that a value-taking flag ends up adjacent to the next flag.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/b9f744cb082df292. Report an issue: GitHub.