{"record":{"id":"c9dc12294eb20564","repo":"Yeachan-Heo/oh-my-codex","slug":"unknown-state-subcommand-subcommand-state-he","errorCode":null,"errorMessage":"Unknown state subcommand: ${subcommand}\n${STATE_HELP}","messagePattern":"Unknown state subcommand: (.+?)\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/state.ts","lineNumber":83,"sourceCode":"}\n\nexport async function stateCommand(\n  args: string[],\n  deps: StateCommandDependencies = {},\n): Promise<void> {\n  const stdout = deps.stdout ?? ((line: string) => console.log(line));\n  const stderr = deps.stderr ?? ((line: string) => console.error(line));\n  const execute = deps.execute ?? executeStateOperation;\n\n  const subcommand = args[0];\n  if (!subcommand || isHelpArg(subcommand)) {\n    stdout(STATE_HELP);\n    return;\n  }\n\n  const operation = STATE_OPERATION_MAP[subcommand];\n  if (!operation) {\n    throw new Error(`Unknown state subcommand: ${subcommand}\\n${STATE_HELP}`);\n  }\n\n  if (isHelpArg(args[1])) {\n    stdout(STATE_HELP);\n    return;\n  }\n\n  let inputValue: string | undefined;\n  let inputFileValue: string | undefined;\n  let modeValue: string | undefined;\n  let json = false;\n  for (let index = 1; index < args.length; index += 1) {\n    const arg = args[index];\n    if (arg === '--json') {\n      json = true;\n      continue;\n    }\n    if (arg === '--input') {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/state.ts#L65-L101","documentation":"The first positional argument to the state command does not match any subcommand in STATE_OPERATION_MAP. Valid subcommands are listed in the printed STATE_HELP text.","triggerScenarios":"`state sett foo` (typo), `state update` when only get/set/clear-style operations exist, or `state` with a stray flag as first token.","commonSituations":"Typos, renaming of subcommands across versions, scripts written against an older CLI surface.","solutions":["Run `state --help` to list valid subcommands","Fix the typo (e.g. `state set ...`)","Pin/align the CLI version your scripts were written for"],"exampleFix":"# before\nstate writestate --input '{}'\n# after\nstate set --input '{}'","handlingStrategy":"type-guard","validationCode":"const KNOWN = new Set(Object.keys(STATE_OPERATION_MAP));\nif (!KNOWN.has(subcommand)) {\n  console.error(`unknown subcommand; valid: ${[...KNOWN].join(', ')}`);\n  process.exit(1);\n}","typeGuard":"const isStateSubcommand = (s: string): s is keyof typeof STATE_OPERATION_MAP =>\n  s in STATE_OPERATION_MAP;","tryCatchPattern":null,"preventionTips":["Derive subcommand lists from `state --help` in scripts","Pin CLI versions in CI to catch renames"],"tags":["cli","argument-validation"],"backgroundTag":"unknown-cli-subcommand","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}