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

sendToWorker: text must be < 200 characters

Error message

sendToWorker: text must be < 200 characters

What it means

Guard inside assertWorkerTriggerText: worker trigger/draft text sent through tmux send-keys must stay under 200 characters. Long payloads wrapped in a single send-keys call can get truncated, interleaved, or misinterpreted by the terminal, so the library rejects them upfront rather than corrupting the worker's input stream.

Solutions

  1. Shorten the trigger text to under 200 characters (move long content to stdin or a file the worker reads)
  2. Split the payload: send short trigger via send-keys and long content via another channel (sendToWorkerStdin or file handoff)
  3. Add a length check upstream in your own code with a clear user-facing error

Example fix

// before
sendToWorkerStdin(worker.stdin, longPrompt); // 500 chars

// after
if (longPrompt.length >= 200) {
  await writeToFile('/tmp/prompt.txt', longPrompt);
  sendToWorkerStdin(worker.stdin, 'read /tmp/prompt.txt and proceed');
} else {
  sendToWorkerStdin(worker.stdin, longPrompt);
}
Defensive patterns

Strategy: validation

Validate before calling

const TRIGGER_MAX = 200;
function isValidTriggerLen(text: string): boolean { return text.length < TRIGGER_MAX; }

Type guard

function isShortTrigger(text: string): boolean { return typeof text === 'string' && text.length < 200 && text.trim().length > 0; }

Prevention

When it happens

Trigger: Calling sendToWorker / sendToWorkerStdin / submit flows with a text argument whose .length >= 200 — e.g. pasting a long prompt, a multi-line instruction, or programmatically generated command text into the trigger argument.

Common situations: User copy-pastes a long prompt into a trigger config; an orchestrator builds a trigger string from a template that grows past 200 chars; feeding a file path plus long args as one trigger.

Related errors


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

Appendix: source

Thrown at src/team/tmux-session.ts:3738

  sleepFractionalSeconds(0.12);
  const secondTarget = resolveTarget();
  if (!secondTarget) return false;
  runTmux(['send-keys', '-t', secondTarget, 'Enter']);
  return true;
}

export const normalizeTmuxCapture = sharedNormalizeTmuxCapture;

function normalizeWorkerTriggerForDraftMatch(value: string | null | undefined): string {
  // Codex/tmux can wrap long path-like trigger text after a hyphen, e.g.
  // `worker-\n  1/inbox.md`. Treat those visual wraps as the original token so
  // delivery verification does not mistake an unsent draft for consumed input.
  return normalizeTmuxCapture(value ?? '').replace(/-\s+/g, '-');
}

function assertWorkerTriggerText(text: string): void {
  if (text.length >= 200) {
    throw new Error('sendToWorker: text must be < 200 characters');
  }
  if (text.trim().length === 0) {
    throw new Error('sendToWorker: text must be non-empty');
  }
  if (text.includes(INJECTION_MARKER)) {
    throw new Error('sendToWorker: injection marker is not allowed');
  }
}

export function sendToWorkerStdin(
  stdin: Pick<NodeJS.WritableStream, 'write' | 'writable'> | null | undefined,
  text: string,
): void {
  assertWorkerTriggerText(text);
  if (!stdin || !stdin.writable) {
    throw new Error('sendToWorkerStdin: stdin is not writable');
  }
  stdin.write(`${text}\n`);

View on GitHub (pinned to 3ad79a8a6f)