{"record":{"id":"d5126f91a5d3a413","repo":"affaan-m/ECC","slug":"unknown-command-resolution-command","errorCode":null,"errorMessage":"Unknown command: ${resolution.command}","messagePattern":"Unknown command: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ecc.js","lineNumber":321,"sourceCode":"\n  return 1;\n}\n\nfunction main() {\n  try {\n    const resolution = resolveCommand(process.argv);\n\n    if (resolution.mode === 'help') {\n      showHelp(0);\n    }\n\n    if (resolution.mode === 'help-command') {\n      if (!resolution.command) {\n        showHelp(0);\n      }\n\n      if (!COMMANDS[resolution.command]) {\n        throw new Error(`Unknown command: ${resolution.command}`);\n      }\n\n      process.exitCode = runCommand(resolution.command, ['--help']);\n      return;\n    }\n\n    process.exitCode = runCommand(resolution.command, resolution.args);\n  } catch (error) {\n    console.error(`Error: ${error.message}`);\n    process.exit(1);\n  }\n}\n\nmain();\n","sourceCodeStart":303,"sourceCodeEnd":336,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/ecc.js#L303-L336","documentation":"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'].","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `node scripts/ecc.js --help` (without a command name) to list all valid commands.","Correct the command name typo before appending --help.","Verify the command exists in the COMMANDS map in your installed ECC version."],"exampleFix":"// before\nnode scripts/ecc.js instal --help\n// after\nnode scripts/ecc.js install --help","handlingStrategy":"validation","validationCode":"const knownCommands = Object.keys(COMMANDS);\nif (resolution.mode === 'help-command' && !knownCommands.includes(resolution.command)) {\n  console.error(`Unknown command: ${resolution.command}. Available: ${knownCommands.join(', ')}`);\n  process.exit(1);\n}","typeGuard":"function isHelpableCommand(name, COMMANDS) {\n  return typeof name === 'string' && Object.prototype.hasOwnProperty.call(COMMANDS, name);\n}","tryCatchPattern":null,"preventionTips":["Validate the command name before entering help-command mode.","Print available commands in the error message to help the user self-correct.","Tab-complete command names in your shell to avoid typos."],"tags":["cli","argument-parsing","help","user-input"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}