affaan-m/ECC · error · Error

Unknown Nasiko status argument

Error message

Unknown Nasiko status argument: ${argument}

What it means

The `status` subcommand only accepts --json and --install-dir. parseStatusArguments throws this error for any other token, keeping the status parser strict so typos fail fast instead of being ignored. The offending argument is interpolated into the message.

Solutions

  1. Use only --json and --install-dir <path> with the status command.
  2. Remove flags like --version that belong to install/uninstall.
  3. Fix typos in the flag name.
  4. Check the usage text printed by the script for the exact accepted flags.

Example fix

// before
node scripts/nasiko.js status --version v0.1.0
// after
node scripts/nasiko.js status --json
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['--json','--install-dir']);
const bad = args.filter(a => a.startsWith('--') && !ALLOWED.has(a));
if (bad.length) throw new Error(`status accepts only --json and --install-dir, got: ${bad.join(' ')}`);

Try / catch

try {
  runNasiko(['status', ...statusArgs]);
} catch (err) {
  if (err.message.startsWith('Unknown Nasiko status argument')) {
    console.error('Use only --json and --install-dir with nasiko status.');
  } else throw err;
}

Prevention

When it happens

Trigger: Running `nasiko status --verbose`, `nasiko status -h`, or a mutation-only flag like `--version v0.1.0` against the status command; any unrecognized token in the status argument list.

Common situations: Copying flags from the install/uninstall command into status (e.g. --version, which status does not need); typos like --instal-dir; passing subcommand-agnostic flags like --help that this minimal parser does not implement.

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/7b9d192bfba131b4. Report an issue: GitHub.

Appendix: source

Thrown at scripts/nasiko.js:96

}

function readStatus(options = {}) {
  const executable = resolveExecutable(options);
  if (!executable) return { installed: false, qualified: false, version: null, executable: null };
  return inspectInstalledNasiko(executable);
}

function parseStatusArguments(argumentsList) {
  let options = { installDir: undefined, json: false };
  for (let index = 0; index < argumentsList.length; index += 1) {
    const argument = argumentsList[index];
    if (argument === '--json') options = { ...options, json: true };
    else if (argument === '--install-dir') {
      const value = argumentsList[index + 1];
      if (!value || value.startsWith('--')) throw new Error('Missing value for --install-dir.');
      options = { ...options, installDir: validateInstallDirectory(value) };
      index += 1;
    } else throw new Error(`Unknown Nasiko status argument: ${argument}`);
  }
  return options;
}

async function main(argumentsList = process.argv.slice(2)) {
  const [command, ...rest] = argumentsList;
  if (!command || command === '--help' || command === '-h' || command === 'help') {
    process.stdout.write(helpText());
    return 0;
  }
  if (command === 'status') {
    const options = parseStatusArguments(rest);
    const status = readStatus(options);
    if (options.json) process.stdout.write(`${JSON.stringify(status, null, 2)}\n`);
    else process.stdout.write(status.qualified
      ? `Qualified Nasiko ${status.version} is installed at ${status.executable}.\n`
      : status.installed
        ? `An unqualified Nasiko file exists at ${status.executable}; it was not executed.\n`

View on GitHub (pinned to 8321021c54)