{"record":{"id":"0ed868e4bd92191b","repo":"Yeachan-Heo/oh-my-codex","slug":"unknown-hooks-subcommand-subcommand","errorCode":null,"errorMessage":"Unknown hooks subcommand: ${subcommand}","messagePattern":"Unknown hooks subcommand: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/hooks.ts","lineNumber":86,"sourceCode":"    case 'init':\n      await initHooks();\n      return;\n    case 'status':\n      await statusHooks();\n      return;\n    case 'validate':\n      await validateHooks();\n      return;\n    case 'test':\n      await testHooks();\n      return;\n    case 'help':\n    case '--help':\n    case '-h':\n      console.log(HELP);\n      return;\n    default:\n      throw new Error(`Unknown hooks subcommand: ${subcommand}`);\n  }\n}\n\nasync function initHooks(): Promise<void> {\n  const cwd = process.cwd();\n  const dir = hooksDir(cwd);\n  const samplePath = samplePluginPath(cwd);\n  await mkdir(dir, { recursive: true });\n\n  if (existsSync(samplePath)) {\n    console.log(`hooks scaffold already exists: ${samplePath}`);\n    return;\n  }\n\n  await writeFile(samplePath, SAMPLE_PLUGIN);\n  console.log(`Created ${samplePath}`);\n  console.log('Plugins are enabled by default. Disable with OMX_HOOK_PLUGINS=0.');\n}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/hooks.ts#L68-L104","documentation":"The `hooks` CLI command dispatches on its first positional argument against a fixed subcommand list (including `init`, `validate`, `help`). An unrecognized subcommand falls through the switch and throws this error.","triggerScenarios":"Running `omx hooks <unknown>` where the first arg matches no case (e.g. `omx hooks instal`, or a subcommand removed/renamed in this version).","commonSituations":"Typos, aliases from other tools (e.g. `hooks add`), or version drift where a subcommand no longer exists.","solutions":["Run `omx hooks help` to list supported subcommands","Correct the subcommand spelling","Check the changelog if you expected the subcommand to exist"],"exampleFix":"# before\nomx hooks instal\n\n# after\nomx hooks init","handlingStrategy":"validation","validationCode":"const KNOWN_HOOKS = new Set(['init', 'validate', 'help', '--help', '-h']); // sync with hooks.ts switch\nconst sub = args[0];\nif (!sub || !KNOWN_HOOKS.has(sub)) {\n  console.error(`Unknown hooks subcommand. Valid: init, validate, help`);\n  process.exit(1);\n}","typeGuard":"function isHooksSubcommand(s: string | undefined): s is 'init' | 'validate' | 'help' {\n  return !!s && ['init', 'validate', 'help'].includes(s);\n}","tryCatchPattern":"try {\n  await hooksCommand(args);\n} catch (e) {\n  if ((e as Error).message.startsWith('Unknown hooks subcommand')) { /* print HELP text */ }\n  else throw e;\n}","preventionTips":["Print `omx hooks help` output in onboarding docs","Keep subcommand constants shared between scripts and CLI"],"tags":["cli","argument-validation","hooks"],"backgroundTag":"unknown-cli-subcommand","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}