affaan-m/ECC · error · Error

Unknown command: ${resolution.command}

Error message

Unknown command: ${resolution.command}

What it means

Thrown in main() of scripts/ecc.js when the CLI is invoked in help-command mode (e.g. `ecc <cmd> --help`) but the requested command name does not exist in the COMMANDS registry. The code checks resolution.mode === 'help-command', then verifies the command exists before delegating to runCommand with ['--help'].

Source

Thrown at scripts/ecc.js:321

  return 1;
}

function main() {
  try {
    const resolution = resolveCommand(process.argv);

    if (resolution.mode === 'help') {
      showHelp(0);
    }

    if (resolution.mode === 'help-command') {
      if (!resolution.command) {
        showHelp(0);
      }

      if (!COMMANDS[resolution.command]) {
        throw new Error(`Unknown command: ${resolution.command}`);
      }

      process.exitCode = runCommand(resolution.command, ['--help']);
      return;
    }

    process.exitCode = runCommand(resolution.command, resolution.args);
  } catch (error) {
    console.error(`Error: ${error.message}`);
    process.exit(1);
  }
}

main();

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Run `node scripts/ecc.js --help` (without a command name) to list all valid commands.
  2. Correct the command name typo before appending --help.
  3. Verify the command exists in the COMMANDS map in your installed ECC version.

Example fix

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

Strategy: validation

Validate before calling

const knownCommands = Object.keys(COMMANDS);
if (resolution.mode === 'help-command' && !knownCommands.includes(resolution.command)) {
  console.error(`Unknown command: ${resolution.command}. Available: ${knownCommands.join(', ')}`);
  process.exit(1);
}

Type guard

function isHelpableCommand(name, COMMANDS) {
  return typeof name === 'string' && Object.prototype.hasOwnProperty.call(COMMANDS, name);
}

Prevention

When it happens

Trigger: Running `node scripts/ecc.js <unknown-cmd> --help` where <unknown-cmd> is not in COMMANDS. The resolver identifies the --help flag and enters help-command mode, but the command name itself is invalid.

Common situations: Typing `ecc instal --help` (typo), asking for help on a command that was removed in an upgrade, or a script/tool wrapping ECC that passes a stale command name.

Related errors


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