{"record":{"id":"d5126f91a5d3a413","repo":"affaan-m/ECC","slug":"unknown-command-resolution-command","errorCode":null,"errorMessage":"Unknown command: ${resolution.command}","messagePattern":"Unknown command: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ecc.js","lineNumber":329,"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":311,"sourceCodeEnd":344,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/ecc.js#L311-L344","documentation":"main throws when resolving a per-command help request for a command name not present in the COMMANDS map — i.e. `ecc <unknown-cmd> --help` (or an unregistered name reached resolveCommand's help path). The faulting input is resolution.command.","triggerScenarios":"Running `ecc help <name>` or `ecc <name> --help` where <name> resolves through the help-command resolution path but is not a key in COMMANDS.","commonSituations":"Asking for help on a mistyped or removed command, old documentation referencing renamed commands, or shell completion suggesting stale command names.","solutions":["Run `ecc --help` to list valid commands.","Fix the command name typo in the invocation or npm script.","Register the command in COMMANDS (and package.json bin/files) if it is meant to exist."],"exampleFix":"// before\n$ ecc help instal\nError: Unknown command: instal\n// after\n$ ecc help install","handlingStrategy":"validation","validationCode":"if (process.argv[2] === 'help') {\n  const target = process.argv[3];\n  if (target && !COMMANDS[target]) {\n    console.error(`No such command: ${target}. See ecc --help.`);\n    process.exit(1);\n  }\n}","typeGuard":"const hasCommand = (name) => typeof name === 'string' && !!COMMANDS[name];","tryCatchPattern":"try {\n  main();\n} catch (err) {\n  if (/^Unknown command:/.test(err.message)) {\n    showHelp(1);\n  } else {\n    throw err;\n  }\n}","preventionTips":["List commands with bare `ecc --help` instead of guessing `ecc help <name>`.","Keep completions/docs in sync with the installed ECC version.","Verify command names in scripts before chaining them in CI."],"tags":["cli","command-not-found","help"],"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"}