{"record":{"id":"7c95c6b372379031","repo":"affaan-m/ECC","slug":"unknown-catalog-command-options-command","errorCode":null,"errorMessage":"Unknown catalog command: ${options.command}","messagePattern":"Unknown catalog command: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/catalog.js","lineNumber":179,"sourceCode":"        printComponents(components);\n      }\n      return;\n    }\n\n    if (options.command === 'show') {\n      if (!options.componentId) {\n        throw new Error('Catalog show requires an install component ID');\n      }\n      const component = getInstallComponent(options.componentId);\n      if (options.json) {\n        console.log(JSON.stringify(component, null, 2));\n      } else {\n        printComponent(component);\n      }\n      return;\n    }\n\n    throw new Error(`Unknown catalog command: ${options.command}`);\n  } catch (error) {\n    console.error(`Error: ${error.message}`);\n    process.exit(1);\n  }\n}\n\nmain();\n","sourceCodeStart":161,"sourceCodeEnd":187,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/catalog.js#L161-L187","documentation":"main() is the final dispatcher for catalog subcommands (help, list, show, etc.). If options.command holds a value none of the branches handle, it throws `Unknown catalog command: ${options.command}`; the catch block prints 'Error: ...' to stderr and exits with status 1.","triggerScenarios":"Passing an unrecognized subcommand as argv[2] (e.g. `catalog instal` or an unsupported `catalog search`), or calling main programmatically with options.command set to an unexpected string.","commonSituations":"Typos in subcommands; outdated documentation referencing removed commands; shell aliases prefixing an extra token so the wrong word lands in the command slot; CI scripts renamed commands across versions.","solutions":["Run `node scripts/catalog.js --help` to list valid commands and correct the typo","Check for extra tokens shifting argv positions (a stray flag before the command)","Update automation scripts to the current command names","If programmatically calling main, only pass documented commands"],"exampleFix":"// before\nnode scripts/catalog.js instal\n// Error: Unknown catalog command: instal\n// after\nnode scripts/catalog.js list","handlingStrategy":"validation","validationCode":"const VALID_COMMANDS = ['list','show'];\nconst cmd = process.argv[2];\nif (!VALID_COMMANDS.includes(cmd)) {\n  console.error(`Unknown command '${cmd}'. Valid: ${VALID_COMMANDS.join(', ')}`);\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try {\n  main();\n} catch (err) {\n  if (err.message.startsWith('Unknown catalog command')) {\n    console.error(`${err.message}. Run 'catalog --help'.`);\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Copy commands from --help rather than memory","Keep a single source of truth for command names in team docs","Watch for argv shifts from stray leading flags","Update automation when commands are renamed"],"tags":["cli","command-dispatch","invalid-command"],"backgroundTag":"invalid-cli-argument","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"}