{"record":{"id":"07fd01ef3d58df27","repo":"affaan-m/ECC","slug":"flagname-requires-a-value-07fd01","errorCode":null,"errorMessage":"${flagName} requires a value","messagePattern":"(.+?) requires a value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release-video-suite.js","lineNumber":342,"sourceCode":"    '  --format <text|json>     Output format (default: text)',\n    '  --json                   Alias for --format json',\n    '  --root <dir>             Repository root to inspect (default: cwd)',\n    '  --source-root <dir>      Directory containing ECC 2 source media, with optional _edited subdir',\n    '  --suite-root <dir>       Directory containing render/timeline/transcript outputs',\n    '  --skip-probe             Skip ffprobe duration reads for fixture or dry-run checks',\n    '  --summary                Emit compact JSON when used with --format json',\n    '  --help, -h               Show this help',\n    '',\n    'Environment:',\n    '  ECC_VIDEO_SOURCE_ROOT',\n    '  ECC_VIDEO_RELEASE_SUITE_ROOT',\n  ].join('\\n'));\n}\n\nfunction readArgValue(args, index, flagName) {\n  const value = args[index + 1];\n  if (!value || value.startsWith('--')) {\n    throw new Error(`${flagName} requires a value`);\n  }\n  return value;\n}\n\nfunction parseArgs(argv) {\n  const args = argv.slice(2);\n  const parsed = {\n    format: 'text',\n    help: false,\n    root: path.resolve(process.cwd()),\n    sourceRoot: process.env.ECC_VIDEO_SOURCE_ROOT || '',\n    suiteRoot: process.env.ECC_VIDEO_RELEASE_SUITE_ROOT || '',\n    skipProbe: false,\n    summary: false,\n  };\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/release-video-suite.js#L324-L360","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Supply an explicit value right after the flag: `--root ./path`.","Switch to the `=` form so order cannot collide: `--root=./path`.","If you intended a boolean flag, remove the expectation of a value and use the correct flag name.","Re-run with --help to confirm which flags require values."],"exampleFix":"# before\nnode scripts/release-video-suite.js --root --format json\n# after\nnode scripts/release-video-suite.js --root=./suite --format json","handlingStrategy":"validation","validationCode":"const FLAGS_NEED_VALUE = new Set(['--format', '--root', '--source-root', '--suite-root']);\nfunction assertValuesPresent(argv) {\n  for (let i = 0; i < argv.length; i += 1) {\n    if (FLAGS_NEED_VALUE.has(argv[i])) {\n      const next = argv[i + 1];\n      if (!next || next.startsWith('--')) {\n        throw new Error(`Pre-flight: ${argv[i]} needs a value`);\n      }\n    }\n  }\n}\nassertValuesPresent(process.argv.slice(2));","typeGuard":null,"tryCatchPattern":"try {\n  const parsed = parseArgs(process.argv);\n} catch (err) {\n  console.error(err.message);\n  printHelp();\n  process.exit(2);\n}","preventionTips":["Prefer the `--flag=value` form in scripts to make missing values impossible.","Centralize value-flag names in a Set and pre-flight validate argv before invoking the CLI.","Wrap the CLI in a shell function that surfaces --help on any non-zero exit."],"tags":["cli","argument-parsing","release-video-suite"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}