affaan-m/ECC · error · Error

Unknown command: ${firstArg}

Error message

Unknown command: ${firstArg}

What it means

Thrown by the ECC CLI entrypoint (scripts/ecc.js) when the first positional argument is not a known subcommand, not a recognized legacy language, and does not start with a dash (flag). The CLI tries to resolve the first argument as a command name, then falls back to treating it as an implicit 'install' if it looks like a flag or a known language; anything else is rejected as unknown.

Source

Thrown at scripts/ecc.js:246

    };
  }

  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 01e15490f0)

Solutions

  1. Run `node scripts/ecc.js --help` to see the list of valid commands.
  2. Check for typos in the command name you passed as the first argument.
  3. If you expect it to be treated as an install target, verify it appears in listAvailableLanguages() or prefix it with a dash flag.
  4. Update ECC to the latest version in case the command was renamed or added.

Example fix

// before
node scripts/ecc.js instal typescript
// after
node scripts/ecc.js install typescript
Defensive patterns

Strategy: validation

Validate before calling

const knownCommands = Object.keys(COMMANDS);
const knownLangs = listAvailableLanguages();
if (!knownCommands.includes(firstArg) && !firstArg.startsWith('-') && !knownLangs.includes(firstArg)) {
  console.error(`Invalid command: ${firstArg}. Available: ${knownCommands.join(', ')}`);
  process.exit(1);
}

Type guard

function isKnownCommand(arg, COMMANDS, languages) {
  return Object.prototype.hasOwnProperty.call(COMMANDS, arg)
    || arg.startsWith('-')
    || languages.includes(arg);
}

Prevention

When it happens

Trigger: Running `node scripts/ecc.js <something>` where `<something>` is neither a registered command in COMMANDS, nor a flag (does not start with '-'), nor a value returned by listAvailableLanguages(). For example `npx ecc foo` or a typo like `npx ecc instal` (missing 'l').

Common situations: Typos in subcommand names (e.g. 'instal' instead of 'install'), using a command that was removed or renamed in a newer ECC version, or passing a positional that the user thinks is valid but is not in the legacy languages list.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/724da75f0d13d262. Report an issue: GitHub.