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

Missing value after ${flag}

Error message

Missing value after ${flag}

What it means

While parsing imagegen continuation flags, a flag expecting a value (--artifact, --actor, etc.) was the last argument, so readValue found no following token. The error names the flag missing its value.

Source

Thrown at src/imagegen/continuation.ts:164

  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;
    };

    if (arg === "--json") {
      json = true;
    } else if (arg === "--artifact" || arg === "--artifact-name") {
      artifactName = readValue(arg);
    } else if (arg.startsWith("--artifact=")) {
      artifactName = arg.slice("--artifact=".length);
    } else if (arg.startsWith("--artifact-name=")) {
      artifactName = arg.slice("--artifact-name=".length);
    } else if (arg === "--generated-dir" || arg === "--generated-images-dir") {
      generatedImagesDir = readValue(arg);
    } else if (arg.startsWith("--generated-dir=")) {
      generatedImagesDir = arg.slice("--generated-dir=".length);
    } else if (arg.startsWith("--generated-images-dir=")) {
      generatedImagesDir = arg.slice("--generated-images-dir=".length);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Supply the value after the flag: --artifact name.png
  2. Use the --flag=value form so the value is part of one token
  3. Check that shell variables in the command are set and quoted

Example fix

// before
["continuation","s1","--artifact"]
// after
["continuation","s1","--artifact=name.png"]
Defensive patterns

Strategy: validation

Validate before calling

const VALUE_FLAGS = new Set(['--artifact','--actor','--generated-images-dir','--work-dir','--prompt-file']);
for (let i=0;i<args.length;i++){ if (VALUE_FLAGS.has(args[i]) && !args[i+1]) throw new Error(`dangling ${args[i]}`); }

Try / catch

catch (e) { if ((e as Error).message.startsWith('Missing value after')) { /* append the value or use --flag=value */ } }

Prevention

When it happens

Trigger: An args array ending in a value-taking flag, e.g. ['continuation','s1','--artifact'] or ['prepare','s1','--actor'] with nothing after.

Common situations: Truncated command lines, shell splitting on unquoted spaces dropping a value, or scripted invocation where a variable expanded to empty and the flag was left dangling.

Related errors


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