Yeachan-Heo/oh-my-codex · error · Error

IMAGEGEN_CONTINUATION_USAGE

Error message

IMAGEGEN_CONTINUATION_USAGE

What it means

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.

Source

Thrown at src/imagegen/continuation.ts:148

    allowInactiveSession: true,
  });

  return {
    record,
    pendingPath,
    followupId: followup.queued.id,
    queuePath: followup.queuePath,
  };
}

function readFileForCli(path: string): string {
  return readFileSync(path, "utf-8");
}

export function parseImagegenContinuationArgs(args: string[]): ParsedImagegenContinuationArgs {
  const [subcommand, sessionIdRaw, ...rest] = args;
  if (subcommand !== "continuation" && subcommand !== "prepare") {
    throw new Error(IMAGEGEN_CONTINUATION_USAGE);
  }
  const sessionId = normalizeSessionId(sessionIdRaw ?? "");

  let artifactName = "";
  let generatedImagesDir: string | undefined;
  let workDir: string | undefined;
  let after: string | undefined;
  let resumeInstruction: string | undefined;
  let actor: string | undefined;
  let json = false;

  for (let i = 0; i < rest.length; i += 1) {
    const arg = rest[i]!;
    const readValue = (flag: string): string => {
      const value = rest[i + 1];
      if (!value) throw new Error(`Missing value after ${flag}`);
      i += 1;
      return value;

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Check the usage message embedded in the error and use the documented subcommand
  2. Ensure the subcommand is the first argument after the module name
  3. Fix wrappers that consume or reorder positional args

Example fix

// before
parseImagegenContinuationArgs(["cont", "sess1"])
// after
parseImagegenContinuationArgs(["continuation", "sess1"])
// or
parseImagegenContinuationArgs(["prepare", "sess1"])
Defensive patterns

Strategy: validation

Validate before calling

const SUB = new Set(['continuation','prepare']);
if (!SUB.has(args[0])) { printUsage(); process.exit(2); }

Type guard

function isSubcommand(a: string | undefined): a is 'continuation'|'prepare' { return a === 'continuation' || a === 'prepare'; }

Try / catch

catch (e) { if ((e as Error).message === IMAGEGEN_CONTINUATION_USAGE) { showHelp(); } }

Prevention

When it happens

Trigger: Invoking the parser with args like ['status'], ['resume'], or an empty array as the first element.

Common situations: Calling the CLI with the wrong subcommand name, a typo ('continue' instead of 'continuation'), or a wrapper that swallows the first argument.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/bb611d8098cd85e5. Report an issue: GitHub.