affaan-m/ECC · error · Error

${flagName} requires a value

Error message

${flagName} requires a value

What it means

Thrown by readArgValue() in the release-video-suite CLI when a value-taking flag (--format, --root, --source-root, --suite-root) is immediately followed by either nothing or another token that begins with '--'. The parser refuses to silently consume a neighboring flag as a value, so it aborts with the flag name that is missing its value.

Source

Thrown at scripts/release-video-suite.js:342

    '  --format <text|json>     Output format (default: text)',
    '  --json                   Alias for --format json',
    '  --root <dir>             Repository root to inspect (default: cwd)',
    '  --source-root <dir>      Directory containing ECC 2 source media, with optional _edited subdir',
    '  --suite-root <dir>       Directory containing render/timeline/transcript outputs',
    '  --skip-probe             Skip ffprobe duration reads for fixture or dry-run checks',
    '  --summary                Emit compact JSON when used with --format json',
    '  --help, -h               Show this help',
    '',
    'Environment:',
    '  ECC_VIDEO_SOURCE_ROOT',
    '  ECC_VIDEO_RELEASE_SUITE_ROOT',
  ].join('\n'));
}

function readArgValue(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()),
    sourceRoot: process.env.ECC_VIDEO_SOURCE_ROOT || '',
    suiteRoot: process.env.ECC_VIDEO_RELEASE_SUITE_ROOT || '',
    skipProbe: false,
    summary: false,
  };

  for (let index = 0; index < args.length; index += 1) {
    const arg = args[index];

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Supply an explicit value right after the flag: `--root ./path`.
  2. Switch to the `=` form so order cannot collide: `--root=./path`.
  3. If you intended a boolean flag, remove the expectation of a value and use the correct flag name.
  4. Re-run with --help to confirm which flags require values.

Example fix

# before
node scripts/release-video-suite.js --root --format json
# after
node scripts/release-video-suite.js --root=./suite --format json
Defensive patterns

Strategy: validation

Validate before calling

const FLAGS_NEED_VALUE = new Set(['--format', '--root', '--source-root', '--suite-root']);
function assertValuesPresent(argv) {
  for (let i = 0; i < argv.length; i += 1) {
    if (FLAGS_NEED_VALUE.has(argv[i])) {
      const next = argv[i + 1];
      if (!next || next.startsWith('--')) {
        throw new Error(`Pre-flight: ${argv[i]} needs a value`);
      }
    }
  }
}
assertValuesPresent(process.argv.slice(2));

Try / catch

try {
  const parsed = parseArgs(process.argv);
} catch (err) {
  console.error(err.message);
  printHelp();
  process.exit(2);
}

Prevention

When it happens

Trigger: Running the script with a trailing value-flag and no argument (e.g. `node scripts/release-video-suite.js --root`), placing two flags adjacent so the second is read as the first's value (e.g. `--root --format json`), or a shell/quoting slip that drops the intended path.

Common situations: Copy-pasting a command and forgetting to substitute the path; reordering flags in a CI script so a value-flag lands last; typos where the user thought a boolean flag like --summary or --help took a value.

Related errors


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