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

Invalid --after timestamp: ${value}

Error message

Invalid --after timestamp: ${value}

What it means

The --after flag for imagegen continuation accepts an ISO timestamp or the literal 'now'; any value Date.parse cannot resolve throws this error echoing the bad input. This guards downstream resume logic from unparseable timestamps.

Source

Thrown at src/imagegen/continuation.ts:76

  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}`);
  }
  return new Date(parsed).toISOString();
}

function defaultResumeInstruction(
  record: Omit<ImagegenContinuationRecord, "resume_instruction">,
  pendingPath: string,
): string {
  const generatedDir = record.generated_images_dir || "$CODEX_HOME/generated_images/<session>";
  const workDir = record.work_dir || ".omx imagegen artifact workspace";
  return [
    `Resume the interrupted Ralph visual/imagegen workflow for artifact "${record.artifact_name}".`,
    `Read pending imagegen metadata at ${pendingPath} if needed.`,
    `Locate the newest generated image in ${generatedDir} created after ${record.after}.`,
    `Copy it into ${workDir}, preserve the raw artifact, then run the required crop/post-process and visual QA/visual-verdict gate before any next edit.`,
    "Update Ralph progress/checkpoint state with fresh verification evidence, then continue the workflow instead of stopping solely because image generation completed.",
  ].join("\n");
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Use ISO 8601 format (2024-08-27T12:00:00Z) or the literal 'now'
  2. Validate the timestamp in the caller with Date.parse before passing it
  3. Quote the argument to prevent shell mangling

Example fix

// before
--after "12/31/2024 3pm"
// after
--after 2024-12-31T15:00:00.000Z
Defensive patterns

Strategy: validation

Validate before calling

if (after !== 'now' && !Number.isFinite(Date.parse(after))) throw new Error('bad --after'); // fix before calling

Type guard

function isIsoOrNow(v: string): boolean { return v === 'now' || Number.isFinite(Date.parse(v)); }

Prevention

When it happens

Trigger: Passing --after with a non-date string such as 'yesterday', '2024-13-45', or a locale-formatted date that Date.parse rejects (e.g. '12/31/2024 3pm').

Common situations: Shell-quoting mistakes, locale-specific date formats, relative date words, or a variable that was never set producing garbage.

Related errors


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