{"record":{"id":"724da75f0d13d262","repo":"affaan-m/ECC","slug":"unknown-command-firstarg","errorCode":null,"errorMessage":"Unknown command: ${firstArg}","messagePattern":"Unknown command: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ecc.js","lineNumber":254,"sourceCode":"    };\n  }\n\n  if (COMMANDS[firstArg]) {\n    return {\n      mode: 'command',\n      command: firstArg,\n      args: restArgs,\n    };\n  }\n\n  const knownLegacyLanguages = listAvailableLanguages();\n  const shouldTreatAsImplicitInstall = (\n    firstArg.startsWith('-')\n    || knownLegacyLanguages.includes(firstArg)\n  );\n\n  if (!shouldTreatAsImplicitInstall) {\n    throw new Error(`Unknown command: ${firstArg}`);\n  }\n\n  return {\n    mode: 'command',\n    command: 'install',\n    args,\n  };\n}\n\nfunction runCommand(commandName, args) {\n  const command = COMMANDS[commandName];\n  if (!command) {\n    throw new Error(`Unknown command: ${commandName}`);\n  }\n  const isItoLogin = commandName === 'ito' && getInvocationCommand(args) === 'login';\n  const result = spawnSync(\n    process.execPath,\n    [path.join(__dirname, command.script), ...args],","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/ecc.js#L236-L272","documentation":"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.","triggerScenarios":"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 '-'.","commonSituations":"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.","solutions":["Check `ecc --help` for the exact list of supported commands and spell the command exactly as shown.","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.","Update the ECC plugin/CLI to the latest version if the command was renamed in a recent release."],"exampleFix":"// before\n$ ecc instal\nError: Unknown command: instal\n// after\n$ ecc install","handlingStrategy":"validation","validationCode":"const KNOWN = ['install','update','uninstall','help'];\nif (!firstArg.startsWith('-') && !KNOWN.includes(firstArg)) {\n  console.error(`Unknown command: ${firstArg}. Run ecc --help.`);\n  process.exit(1);\n}","typeGuard":"const isKnownCommand = (s) => typeof s === 'string' && COMMANDS[s] !== undefined;","tryCatchPattern":"try {\n  main();\n} catch (err) {\n  if (/^Unknown command:/.test(err.message)) {\n    console.error(`${err.message}\\nRun 'ecc --help' for available commands.`);\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Run `ecc --help` before using an unfamiliar subcommand.","Enable shell completion generated from the COMMANDS registry.","Keep the ECC plugin updated so command names match docs.","Alias frequently used commands to avoid typos."],"tags":["cli","command-not-found","argument-parsing"],"backgroundTag":"command-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}