affaan-m/ECC · error · Error
Unknown Nasiko argument
Error message
Unknown Nasiko ${command} argument: ${argument} What it means
parseMutationArguments whitelists the flags it accepts (--version, --install-dir, --yes/-y, --dry-run, --json). Any other token reaches the final else branch and throws `Unknown Nasiko ${command} argument: ${argument}`. After parsing, it also enforces that --version was supplied. This error is specifically the unrecognized-argument branch.
Solutions
- Remove the unsupported flag; use only --version, --install-dir, --yes/-y, --dry-run, --json.
- Fix flag spelling/separators: use `--install-dir`, not `--installdir`; pass short flags individually (`-y`, not `-vy`).
- Check the script's argument parser (scripts/nasiko.js) for the current accepted flag set if docs are stale.
- If behavior like --force is genuinely needed, extend parseMutationArguments with an explicit branch rather than passing unknown flags.
Example fix
// before node scripts/nasiko.js install --version v0.1.0 --force // after node scripts/nasiko.js install --version v0.1.0 --yes
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = new Set(['--version', '--install-dir', '--yes', '-y', '--dry-run', '--json']);
const bad = args.filter((a) => a.startsWith('-') && !ALLOWED.has(a));
if (bad.length) throw new Error(`Unsupported Nasiko flags: ${bad.join(', ')}`); Try / catch
try {
options = parseMutationArguments(args, command);
} catch (err) {
if (String(err.message).startsWith('Unknown Nasiko')) {
console.error(`${err.message} Allowed: --version --install-dir --yes/-y --dry-run --json.`);
process.exitCode = 64;
} else throw err;
} Prevention
- Restrict generated invocations to the whitelisted flag set.
- Do not combine short flags; pass -y on its own.
- Check for typos in long flags (--install-dir, not --installdir/--dir).
- Diff flags against the parseMutationArguments whitelist when migrating scripts from other installers.
When it happens
Trigger: Passing an unsupported flag to a Nasiko mutation command (e.g. `--force`, `--verbose`, a combined `-vy`, or a misspelled `--installdir`), so the token falls into the else branch of parseMutationArguments.
Common situations: Copy-pasting flags from another CLI's install command; assuming combined short flags work; typos in long flags; scripts carrying over flags from an older version of the Nasiko script that accepted more options.
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
- requires a value.
- does not accept positional arguments.
- --exit-code with --watch requires --watch-count so the…
- must be a positive integer
- requires a value
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/e47532e5485cd716.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/nasiko.js:49
let options = { dryRun: false, installDir: undefined, json: false, version: undefined, yes: false };
for (let index = 0; index < argumentsList.length; index += 1) {
const argument = argumentsList[index];
if (argument === '--version' || argument === '--install-dir') {
const value = argumentsList[index + 1];
if (!value || value.startsWith('--')) throw new Error(`Missing value for ${argument}.`);
options = {
...options,
[argument === '--version' ? 'version' : 'installDir']: value,
};
index += 1;
} else if (argument === '--yes' || argument === '-y') {
options = { ...options, yes: true };
} else if (argument === '--dry-run') {
options = { ...options, dryRun: true };
} else if (argument === '--json') {
options = { ...options, json: true };
} else {
throw new Error(`Unknown Nasiko ${command} argument: ${argument}`);
}
}
if (!options.version) throw new Error(`Nasiko ${command} requires --version v0.1.0.`);
if (options.installDir) validateInstallDirectory(options.installDir);
return options;
}
function defaultExecutablePath() {
const normalized = normalizePlatform();
if (normalized.os === 'windows') {
return process.env.LOCALAPPDATA
? path.join(process.env.LOCALAPPDATA, 'nasiko', 'bin', normalized.binaryName)
: null;
}
return path.join(os.homedir(), '.local', 'bin', normalized.binaryName);
}
function resolveExecutable(options = {}) {View on GitHub (pinned to 8321021c54)