affaan-m/ECC · error · Error

Unsupported Nasiko command

Error message

Unsupported Nasiko command: ${command}

What it means

main dispatches on the first CLI argument and supports a fixed set of Nasiko commands (install/status/uninstall). If the command token does not match any handler, it throws this error. It is the top-level command router's strict-validation guard.

Solutions

  1. Use one of the supported commands: install, status, or uninstall.
  2. Fix typos in the command name.
  3. Consult the script's usage/help text for the exact command list.
  4. If you need a new command, add a dispatch branch in main in scripts/nasiko.js.

Example fix

// before
node scripts/nasiko.js remove --version v0.1.0
// after
node scripts/nasiko.js uninstall --version v0.1.0
Defensive patterns

Strategy: validation

Validate before calling

const COMMANDS = new Set(['install','status','uninstall']);
const cmd = process.argv[2];
if (!COMMANDS.has(cmd)) throw new Error(`Unsupported command "${cmd}"; use install, status, or uninstall`);

Type guard

const isNasikoCommand = (c) => typeof c === 'string' && ['install','status','uninstall'].includes(c);

Try / catch

try {
  await main(argv);
} catch (err) {
  if (err.message.startsWith('Unsupported Nasiko command')) {
    console.error('Valid commands: install, status, uninstall.');
    process.exitCode = 1;
  } else throw err;
}

Prevention

When it happens

Trigger: Running the script with a typo'd, missing-as-empty, or entirely unsupported first token such as `node scripts/nasiko.js upgrade` or `node scripts/nasiko.js --help`; also invoking with argv slice producing undefined command.

Common situations: Guessing subcommand names (upgrade/reinstall/remove) that don't exist; old scripts using a renamed command; invoking the file with no arguments so command is undefined.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/feb7f0ad027250da. Report an issue: GitHub.

Appendix: source

Thrown at scripts/nasiko.js:134

    return 0;
  }
  if (command === 'install') {
    const options = parseMutationArguments(rest, 'install');
    const result = await installNasiko(options);
    if (options.json) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
    else if (result.dryRun) process.stdout.write(`Would install Nasiko ${result.version} to ${result.destination}.\n`);
    else process.stdout.write(`${result.reused ? 'Using existing' : 'Installed'} Nasiko ${result.version} at ${result.destination}.\n`);
    return 0;
  }
  if (command === 'uninstall') {
    const options = parseMutationArguments(rest, 'uninstall');
    const result = uninstallNasiko(options);
    if (options.json) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
    else if (result.dryRun) process.stdout.write(`Would uninstall Nasiko ${result.version} from ${result.destination}.\n`);
    else process.stdout.write(result.removed ? `Uninstalled Nasiko ${result.version}.\n` : 'Nasiko was not installed.\n');
    return 0;
  }
  throw new Error(`Unsupported Nasiko command: ${command}`);
}

if (require.main === module) {
  main().then(code => {
    process.exitCode = code;
  }).catch(error => {
    process.stderr.write(`Error: ${String(error?.message || error).replace(/[\r\n]+/g, ' ')}\n`);
    process.exitCode = 1;
  });
}

module.exports = { main, parseInstallArguments: parseMutationArguments, parseMutationArguments, parseStatusArguments, readStatus, resolveExecutable };

View on GitHub (pinned to 8321021c54)