affaan-m/ECC · error
Unknown argument
Error message
Unknown argument: ${arg} What it means
parseInstallArgs accepts a known set of flags and treats any bare token starting with `--` that is not recognized as an error. Any unknown double-dash argument throws 'Unknown argument: <arg>'. Non-flag tokens are collected as language names.
Solutions
- Run the installer with `--help` (`-h`) to list valid flags and correct the flag name.
- Check for typos or plural/singular mismatches (e.g. `--locale` not `--locales`).
- Use space-separated values instead of `=` syntax if that's the supported form.
- If the flag existed in an older version, consult the changelog for its replacement.
Example fix
// before install --locales zh-CN // after install --locale zh-CN
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN = new Set(['--target','--locale','--module','--include','--exclude','--profile','--enable-hooks','--no-hooks','--dry-run','--json','--help','-h']);
const unknown = argv.filter(a => a.startsWith('--') && !KNOWN.has(a));
if (unknown.length) throw new Error(`Unknown flags: ${unknown.join(', ')}`); Type guard
null
Try / catch
try {
const request = parseInstallArgs(argv);
} catch (e) {
if (e.message.startsWith('Unknown argument')) {
console.error(`${e.message}. Run with --help to list valid flags.`);
process.exitCode = 2;
return;
}
throw e;
} Prevention
- Check `--help` before using any flag you haven't used before.
- Copy flag examples from current docs, not older tool versions.
- Avoid `--flag=value` syntax unless documented; use space-separated values.
- Lint shell scripts for flag typos against the known flag set.
When it happens
Trigger: Running the installer with an unrecognized flag such as `--locales` (plural), `--target-dir`, `--lang python`, or a typo like `--dry-run=true` when only bare `--dry-run` is supported.
Common situations: Typoed flag names; flags copied from a different tool's CLI; passing `--flag=value` syntax where the parser expects space-separated values or bare booleans; outdated docs referencing a removed flag.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/a6090444f8066fa6.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/install/request.js:85
} else if (arg === '--locale') {
const locale = args[index + 1] || '';
if (!locale || locale.startsWith('--')) {
throw new Error('Missing value for --locale');
}
parsed.locale = locale;
index += 1;
} else if (arg === '--enable-hooks') {
parsed.enableHooks = true;
} else if (arg === '--no-hooks') {
parsed.noHooks = true;
} else if (arg === '--dry-run') {
parsed.dryRun = true;
} else if (arg === '--json') {
parsed.json = true;
} else if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else if (arg.startsWith('--')) {
throw new Error(`Unknown argument: ${arg}`);
} else {
parsed.languages.push(arg);
}
}
return parsed;
}
function normalizeInstallRequest(options = {}) {
const config = options.config && typeof options.config === 'object'
? options.config
: null;
const profileId = options.profileId || config?.profileId || null;
const target = options.target || config?.target || 'claude';
const moduleIds = validateInstallModuleIds(
dedupeStrings([...(config?.moduleIds || []), ...(options.moduleIds || [])])
);
const locale = options.locale || config?.locale || null;View on GitHub (pinned to 8321021c54)