affaan-m/ECC · error · Error

Unknown command

Error message

Unknown command: ${firstArg}

What it means

resolveCommand() validates the first CLI argument to scripts/ecc.js. If the argument is not a flag and not one of the known legacy language shortcuts, and it does not map to a registered command, the CLI throws 'Unknown command: <firstArg>' instead of guessing an install target.

Solutions

  1. Check `ecc --help` for the exact list of supported commands and spell the command exactly as shown.
  2. If you intended to install a language/skill rather than run a command, check whether it belongs to knownLegacyLanguages in scripts/ecc.js or pass an explicit `install` command.
  3. Update the ECC plugin/CLI to the latest version if the command was renamed in a recent release.

Example fix

// before
$ ecc instal
Error: Unknown command: instal
// after
$ ecc install
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = ['install','update','uninstall','help'];
if (!firstArg.startsWith('-') && !KNOWN.includes(firstArg)) {
  console.error(`Unknown command: ${firstArg}. Run ecc --help.`);
  process.exit(1);
}

Type guard

const isKnownCommand = (s) => typeof s === 'string' && COMMANDS[s] !== undefined;

Try / catch

try {
  main();
} catch (err) {
  if (/^Unknown command:/.test(err.message)) {
    console.error(`${err.message}\nRun 'ecc --help' for available commands.`);
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `ecc <name>` where <name> is a typo or an unrecognized subcommand (e.g. `ecc instal`, `ecc updat`) that is neither a command in COMMANDS nor a legacy language in knownLegacyLanguages, and does not start with '-'.

Common situations: Typo'd subcommands, outdated muscle memory from older CLI versions whose command names changed, copy-pasting commands from older docs, or passing a language name removed from knownLegacyLanguages.

Related errors


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

Appendix: source

Thrown at scripts/ecc.js:254

    };
  }

  if (COMMANDS[firstArg]) {
    return {
      mode: 'command',
      command: firstArg,
      args: restArgs,
    };
  }

  const knownLegacyLanguages = listAvailableLanguages();
  const shouldTreatAsImplicitInstall = (
    firstArg.startsWith('-')
    || knownLegacyLanguages.includes(firstArg)
  );

  if (!shouldTreatAsImplicitInstall) {
    throw new Error(`Unknown command: ${firstArg}`);
  }

  return {
    mode: 'command',
    command: 'install',
    args,
  };
}

function runCommand(commandName, args) {
  const command = COMMANDS[commandName];
  if (!command) {
    throw new Error(`Unknown command: ${commandName}`);
  }
  const isItoLogin = commandName === 'ito' && getInvocationCommand(args) === 'login';
  const result = spawnSync(
    process.execPath,
    [path.join(__dirname, command.script), ...args],

View on GitHub (pinned to 8321021c54)