affaan-m/ECC · error

requires a value

Error message

${flagName} requires a value

What it means

readArgValue in scripts/release-video-suite.js throws when a flag that expects a value is the last argument or is followed by another flag. It checks that the next argv entry exists and does not start with '--'.

Solutions

  1. Provide the value inline after the flag, e.g. --format json.
  2. Remember this script uses space-separated values (--format json), not the = form (--format=json may be handled elsewhere — verify).
  3. Ensure the value itself doesn't begin with '--'.

Example fix

// before
node scripts/release-video-suite.js --format
// after
node scripts/release-video-suite.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 requires a value');

Try / catch

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

Prevention

When it happens

Trigger: Running `node scripts/release-video-suite.js --format` (nothing after it) or `--format --json` (value looks like another flag).

Common situations: Forgetting the value after a flag, quoting/spacing mistakes leaving the value empty, accidentally passing the value in a separate position that starts with --.

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


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/07fd01ef3d58df27. Report an issue: GitHub.

Appendix: 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 8321021c54)