affaan-m/ECC · error · Error
Unknown argument: ${arg}
Error message
Unknown argument: ${arg} What it means
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.
Source
Thrown at scripts/release-video-suite.js:426
}
if (arg.startsWith('--source-root=')) {
parsed.sourceRoot = path.resolve(arg.slice('--source-root='.length));
continue;
}
if (arg === '--suite-root') {
parsed.suiteRoot = path.resolve(readArgValue(args, index, arg));
index += 1;
continue;
}
if (arg.startsWith('--suite-root=')) {
parsed.suiteRoot = path.resolve(arg.slice('--suite-root='.length));
continue;
}
throw new Error(`Unknown argument: ${arg}`);
}
if (!['text', 'json'].includes(parsed.format)) {
throw new Error(`Invalid format: ${parsed.format}. Use text or json.`);
}
return parsed;
}
function readText(rootDir, relativePath) {
try {
return fs.readFileSync(path.join(rootDir, relativePath), 'utf8');
} catch (_error) {
return '';
}
}
function safeParseJson(text) {View on GitHub (pinned to 01e15490f0)
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.
Example fix
# before node scripts/release-video-suite.js --suite-root ./s --verbse # after node scripts/release-video-suite.js --suite-root ./s --summary
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = new Set(['--format', '--root', '--source-root', '--suite-root', '--summary', '--help', '-h']);
const unknown = process.argv.slice(2).filter(a => a.startsWith('--') && !ALLOWED.has(a.split('=')[0]));
if (unknown.length) { console.error('Unknown flag(s):', unknown.join(' ')); process.exit(2); } Try / catch
try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ${flagName} requires a value
- Invalid format: ${parsed.format}. Use text or json.
- --write requires a path
- Unknown argument: ${arg}
- Invalid ${flag}: expected a single cache path segment
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/6732eac8c72a1a26.
Report an issue: GitHub.