{"record":{"id":"6732eac8c72a1a26","repo":"affaan-m/ECC","slug":"unknown-argument-arg-6732ea","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release-video-suite.js","lineNumber":426,"sourceCode":"    }\n\n    if (arg.startsWith('--source-root=')) {\n      parsed.sourceRoot = path.resolve(arg.slice('--source-root='.length));\n      continue;\n    }\n\n    if (arg === '--suite-root') {\n      parsed.suiteRoot = path.resolve(readArgValue(args, index, arg));\n      index += 1;\n      continue;\n    }\n\n    if (arg.startsWith('--suite-root=')) {\n      parsed.suiteRoot = path.resolve(arg.slice('--suite-root='.length));\n      continue;\n    }\n\n    throw new Error(`Unknown argument: ${arg}`);\n  }\n\n  if (!['text', 'json'].includes(parsed.format)) {\n    throw new Error(`Invalid format: ${parsed.format}. Use text or json.`);\n  }\n\n  return parsed;\n}\n\nfunction readText(rootDir, relativePath) {\n  try {\n    return fs.readFileSync(path.join(rootDir, relativePath), 'utf8');\n  } catch (_error) {\n    return '';\n  }\n}\n\nfunction safeParseJson(text) {","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/release-video-suite.js#L408-L444","documentation":"Thrown at the end of release-video-suite's parseArgs loop when a token is not one of the recognized flags (--format, --root, --source-root, --suite-root, --summary, --help/-h, or their `=` variants). The parser has no fallback and treats any unrecognized token as a fatal usage error.","triggerScenarios":"Passing a typo (e.g. `--suiteroot`), a flag from another tool, or a positional argument the script does not accept. Also triggered by a leading `--` token that is not in the allowlist.","commonSituations":"Renaming flags across versions and running an old command; mixing flags from repair.js/setup.js with this script; an unquoted negative value being parsed as a flag.","solutions":["Run `node scripts/release-video-suite.js --help` to list accepted flags.","Correct the typo to the exact flag name (kebab-case, e.g. --source-root not --sourceroot).","Use the `=` form for value flags to avoid stray tokens.","Remove any positional or unsupported arguments."],"exampleFix":"# before\nnode scripts/release-video-suite.js --suite-root ./s --verbse\n# after\nnode scripts/release-video-suite.js --suite-root ./s --summary","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--format', '--root', '--source-root', '--suite-root', '--summary', '--help', '-h']);\nconst unknown = process.argv.slice(2).filter(a => a.startsWith('--') && !ALLOWED.has(a.split('=')[0]));\nif (unknown.length) { console.error('Unknown flag(s):', unknown.join(' ')); process.exit(2); }","typeGuard":null,"tryCatchPattern":"try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); }","preventionTips":["Keep a shared allowlist of flags and lint commands against it in CI.","Generate --help from the same allowlist so docs and parser never drift.","Reject typos early in a wrapper script before delegating to the CLI."],"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"}