affaan-m/ECC · error · Error
Unknown argument: ${arg}
Error message
Unknown argument: ${arg} What it means
Thrown at the end of release-approval-gate's parseArgs loop when a token matched none of --help/-h, --format(+==), --json, --root(+==). The parser is strict because the gate's verdict must be deterministic and tied to known inputs only.
Source
Thrown at scripts/release-approval-gate.js:158
}
if (arg.startsWith('--format=')) {
parsed.format = arg.slice('--format='.length).toLowerCase();
continue;
}
if (arg === '--root') {
parsed.root = path.resolve(readArgValue(args, index, arg));
index += 1;
continue;
}
if (arg.startsWith('--root=')) {
parsed.root = path.resolve(arg.slice('--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 fileExists(rootDir, relativePath) {View on GitHub (pinned to 01e15490f0)
Solutions
- Run `--help` to confirm the accepted flags for this installed version.
- Pass repo via `--root=<dir>`; format via `--json` or `--format=json`.
- Quote all arguments and verify no expansion produced extra tokens.
Example fix
# before node scripts/release-approval-gate.js --fromat json # after node scripts/release-approval-gate.js --format json
Defensive patterns
Strategy: validation
Validate before calling
const GATE_FLAGS = new Set(['--help','-h','--format','--json','--root']);
function isGateFlag(token) {
const base = token.split('=')[0];
return GATE_FLAGS.has(base);
} Type guard
function isKnownGateFlag(token) {
const base = token.startsWith('--') ? token.split('=')[0] : token;
return GATE_FLAGS.has(base);
} Try / catch
try {
parseArgs(process.argv);
} catch (err) {
if (err.message.startsWith('Unknown argument')) {
console.error(`${err.message}. release-approval-gate only accepts --format and --root.`);
process.exit(2);
}
throw err;
} Prevention
- Only --format and --root are accepted; do not copy flags from other gates.
- Run --help for the authoritative list.
- Quote arguments and verify no shell expansion added tokens.
When it happens
Trigger: A typo like `--formatt`; a positional path instead of `--root`; a flag from platform-audit or preview-pack-smoke that this gate does not share; shell glob injecting a token.
Common situations: User assumes shared flag sets across ECC gates; version mismatch; stray token from unquoted shell expansion.
Related errors
- ${flagName} requires a value
- Invalid format: ${parsed.format}. Use text or json.
- Unknown argument: ${arg}
- Unknown argument: ${arg}
- --timeout-ms must be a positive number
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/0d31d6ef5a012f24.
Report an issue: GitHub.