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

Missing required ${name}

Error message

Missing required ${name}

What it means

A required string argument (e.g. session id or --artifact value) was missing or blank after trimming in the imagegen continuation CLI argument parser. normalizeRequired is used by the arg parser for values that must be present, so an omitted or whitespace-only value produces this error naming the missing field.

Source

Thrown at src/imagegen/continuation.ts:59

  artifactName: string;
  generatedImagesDir?: string;
  workDir?: string;
  after?: string;
  resumeInstruction?: string;
  actor?: string;
  json: boolean;
}

const DEFAULT_ACTOR = "omx-imagegen";
const SESSION_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;

function sessionImagegenPendingPath(cwd: string, sessionId: string): string {
  return join(cwd, ".omx", "state", "sessions", sessionId, "imagegen-pending.json");
}

function normalizeRequired(value: string | undefined, name: string): string {
  const normalized = value?.trim() ?? "";
  if (!normalized) throw new Error(`Missing required ${name}`);
  return normalized;
}

function normalizeSessionId(sessionId: string): string {
  const normalized = normalizeRequired(sessionId, "session id");
  if (!SESSION_ID_PATTERN.test(normalized)) {
    throw new Error("Invalid session id. Expected 1-128 alphanumeric, underscore, or dash characters.");
  }
  return normalized;
}

function normalizeIsoOrNow(value: string | undefined, nowIso: string): string {
  const normalized = value?.trim();
  if (!normalized || normalized.toLowerCase() === "now") return nowIso;
  const parsed = Date.parse(normalized);
  if (!Number.isFinite(parsed)) {
    throw new Error(`Invalid --after timestamp: ${value}`);
  }

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Supply the required flag with a non-empty value (e.g. --artifact <name>)
  2. Check for empty-string expansions in shell scripts ($ARTIFACT unset)
  3. Trim/validate arguments in the calling script before invoking the CLI

Example fix

// before
omx imagegen continuation prepare sess1
// after
omx imagegen continuation prepare sess1 --artifact hero.png
Defensive patterns

Strategy: validation

Validate before calling

if (!String(artifact).trim()) throw new Error('artifact required before calling CLI');

Type guard

function isNonEmptyString(v: unknown): v is string { return typeof v === 'string' && v.trim().length > 0; }

Try / catch

catch (e) { if ((e as Error).message.startsWith('Missing required')) { /* prompt user / fill default */ } }

Prevention

When it happens

Trigger: Calling parseImagegenContinuationArgs where the --artifact value (or session id) is absent, empty, or only whitespace. The error message interpolates the field name, e.g. 'Missing required session id' or 'Missing required --artifact'.

Common situations: Invoking the imagegen continuation subcommand without --artifact, passing --artifact= with no value, or a script dropping an argument mid-pipeline.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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