{"record":{"id":"bb611d8098cd85e5","repo":"Yeachan-Heo/oh-my-codex","slug":"imagegen-continuation-usage","errorCode":null,"errorMessage":"IMAGEGEN_CONTINUATION_USAGE","messagePattern":"IMAGEGEN_CONTINUATION_USAGE","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/imagegen/continuation.ts","lineNumber":148,"sourceCode":"    allowInactiveSession: true,\n  });\n\n  return {\n    record,\n    pendingPath,\n    followupId: followup.queued.id,\n    queuePath: followup.queuePath,\n  };\n}\n\nfunction readFileForCli(path: string): string {\n  return readFileSync(path, \"utf-8\");\n}\n\nexport function parseImagegenContinuationArgs(args: string[]): ParsedImagegenContinuationArgs {\n  const [subcommand, sessionIdRaw, ...rest] = args;\n  if (subcommand !== \"continuation\" && subcommand !== \"prepare\") {\n    throw new Error(IMAGEGEN_CONTINUATION_USAGE);\n  }\n  const sessionId = normalizeSessionId(sessionIdRaw ?? \"\");\n\n  let artifactName = \"\";\n  let generatedImagesDir: string | undefined;\n  let workDir: string | undefined;\n  let after: string | undefined;\n  let resumeInstruction: string | undefined;\n  let actor: string | undefined;\n  let json = false;\n\n  for (let i = 0; i < rest.length; i += 1) {\n    const arg = rest[i]!;\n    const readValue = (flag: string): string => {\n      const value = rest[i + 1];\n      if (!value) throw new Error(`Missing value after ${flag}`);\n      i += 1;\n      return value;","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/imagegen/continuation.ts#L130-L166","documentation":"The imagegen continuation parser requires the first positional argument to be 'continuation' or 'prepare'; anything else (including no arguments at all) throws the usage string IMAGEGEN_CONTINUATION_USAGE. This is effectively the subcommand's usage/help error.","triggerScenarios":"Invoking the parser with args like ['status'], ['resume'], or an empty array as the first element.","commonSituations":"Calling the CLI with the wrong subcommand name, a typo ('continue' instead of 'continuation'), or a wrapper that swallows the first argument.","solutions":["Check the usage message embedded in the error and use the documented subcommand","Ensure the subcommand is the first argument after the module name","Fix wrappers that consume or reorder positional args"],"exampleFix":"// before\nparseImagegenContinuationArgs([\"cont\", \"sess1\"])\n// after\nparseImagegenContinuationArgs([\"continuation\", \"sess1\"])\n// or\nparseImagegenContinuationArgs([\"prepare\", \"sess1\"])","handlingStrategy":"validation","validationCode":"const SUB = new Set(['continuation','prepare']);\nif (!SUB.has(args[0])) { printUsage(); process.exit(2); }","typeGuard":"function isSubcommand(a: string | undefined): a is 'continuation'|'prepare' { return a === 'continuation' || a === 'prepare'; }","tryCatchPattern":"catch (e) { if ((e as Error).message === IMAGEGEN_CONTINUATION_USAGE) { showHelp(); } }","preventionTips":["Check the first arg against the subcommand list before parsing","Keep a single source of truth for subcommand names"],"tags":["cli","imagegen","usage","subcommand"],"backgroundTag":"invalid-cli-usage","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}