Yeachan-Heo/oh-my-codex · error

missing_prompt

missing_prompt

Error message

missing_prompt

What it means

Thrown by normalizePrompt when the prompt passed to exec followup injection is empty after trimming. The library requires a non-whitespace prompt because a followup with no text would be a no-op in the exec session queue. It is a pure input-validation error raised before any filesystem or session work happens.

Source

Thrown at src/exec/followup.ts:81

function errorMessage(error: unknown): string {
  return error instanceof Error ? error.message : String(error);
}

async function sleep(ms: number): Promise<void> {
  await new Promise((resolve) => setTimeout(resolve, ms));
}

function normalizeSessionId(sessionId: string): string {
  const normalized = sessionId.trim();
  if (!SESSION_ID_PATTERN.test(normalized)) {
    throw new Error("invalid_session_id");
  }
  return normalized;
}

function normalizePrompt(prompt: string): string {
  const normalized = prompt.trim();
  if (!normalized) throw new Error("missing_prompt");
  return normalized;
}

function normalizeActor(actor?: string): string {
  const normalized = (actor || process.env.USER || process.env.USERNAME || "unknown").trim();
  return normalized || "unknown";
}

async function appendAudit(cwd: string, event: Record<string, unknown>, nowIso: string): Promise<void> {
  const path = auditLogPath(cwd, nowIso);
  await mkdir(dirname(path), { recursive: true });
  await appendFile(path, JSON.stringify({ ...event, timestamp: nowIso }) + "\n");
}

async function quarantineCorruptQueue(
  path: string,
  sessionId: string,
  options: { cwd: string; nowIso: string; error: unknown },

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Check the prompt is non-empty after trimming before calling the API (or passing it to the CLI).
  2. If the prompt comes from a file, verify the file exists and has content before using --prompt-file.
  3. If building from env vars, fail fast with a clear message when the variable is unset.
  4. Add a unit test asserting empty/whitespace prompts are rejected before reaching the library.

Example fix

// before
await injectExecFollowup(cwd, sessionId, { prompt: process.env.FOLLOWUP_TEXT ?? '' });

// after
const prompt = (process.env.FOLLOWUP_TEXT ?? '').trim();
if (!prompt) throw new Error('FOLLOWUP_TEXT is empty; refusing to inject');
await injectExecFollowup(cwd, sessionId, { prompt });
Defensive patterns

Strategy: validation

Validate before calling

const prompt = rawPrompt.trim();
if (!prompt) throw new Error('prompt is required');
await injectExecFollowup(cwd, sessionId, { prompt });

Type guard

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

Try / catch

try { await injectExecFollowup(cwd, sessionId, { prompt }); }
catch (e) { if (e instanceof Error && e.message === 'missing_prompt') {/* re-collect prompt from user */} else throw e; }

Prevention

When it happens

Trigger: Calling injectExecFollowup (or the CLI `omx exec inject <id> --prompt <text>`) with a prompt that is '', ' ', a tab/newline-only string, or undefined coerced to string. Also triggered by --prompt= with an empty value or a --prompt-file pointing at an empty file.

Common situations: Script builds the prompt from an env var or shell variable that is unset/empty; a CI pipeline passes "$FOLLOWUP_TEXT" before setting it; reading a prompt file that was truncated or empty; UI text box submitted with whitespace only.

Related errors


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