{"record":{"id":"600e6d63c078fda1","repo":"Yeachan-Heo/oh-my-codex","slug":"sendtoworker-failed-to-send-text-send-stderr","errorCode":null,"errorMessage":"sendToWorker: failed to send text: ${send.stderr}","messagePattern":"sendToWorker: failed to send text: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/tmux-session.ts","lineNumber":3452,"sourceCode":"  if (strategy !== 'auto') return false;\n  if (!paneBusyAtStart) return false;\n  if (typeof latestCapture !== 'string') return false;\n\n  const normalizedText = normalizeWorkerTriggerForDraftMatch(text);\n  if (normalizedText === '') return false;\n\n  const normalizedCapture = normalizeWorkerTriggerForDraftMatch(latestCapture);\n  if (!normalizedCapture.includes(normalizedText)) return false;\n  if (paneHasActiveTask(latestCapture)) return false;\n  if (!paneLooksReady(latestCapture)) return false;\n  return true;\n}\n\nasync function sendLiteralTextOrThrow(resolveTarget: AsyncPaneTargetResolver, text: string): Promise<void> {\n  const target = await requireAsyncPaneTarget(resolveTarget);\n  const send = await runTmuxAsync(['send-keys', '-t', target, '-l', '--', text]);\n  if (!send.ok) {\n    throw new Error(`sendToWorker: failed to send text: ${send.stderr}`);\n  }\n}\n\nfunction paneHasQueuedCodexSubmission(captured: string | null | undefined): boolean {\n  const normalized = normalizeTmuxCapture(captured ?? '');\n  if (normalized === '') return false;\n  return /messages to be submitted after next tool call/i.test(normalized)\n    || /press esc to interrupt and send immediately/i.test(normalized);\n}\n\nasync function attemptSubmitRounds(\n  resolveTarget: AsyncPaneTargetResolver,\n  text: string,\n  rounds: number,\n  queueFirstRound: boolean,\n  submitKeyPressesPerRound: number,\n): Promise<boolean> {\n  const presses = Math.max(1, Math.floor(submitKeyPressesPerRound));","sourceCodeStart":3434,"sourceCodeEnd":3470,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/tmux-session.ts#L3434-L3470","documentation":"Thrown when the tmux `send-keys -l` command used to deliver literal text to a worker pane exits non-zero. The error wraps tmux's own stderr, so the underlying cause is a tmux-level failure such as a dead/missing target pane, a detached session, or tmux not being installed. This is a process-spawn failure, not a validation error.","triggerScenarios":"Calling sendLiteralTextOrThrow (or a higher-level sendToWorker path) after the target pane was closed, the tmux server was killed, the session name no longer resolves, or the tmux binary is missing from PATH (runTmuxAsync fails). Also occurs when the resolveTarget pane id becomes stale between resolution and send.","commonSituations":"Worker pane closed by the agent or user mid-run; tmux server restarted; SSH session dropped taking the tmux server with it; stale pane id cached from a previous run; tmux not installed in CI containers.","solutions":["Check send.stderr in the message: 'no such pane'/'can't find session' means the pane/session is gone — recreate the worker pane and retry","Verify tmux is installed and the tmux server is running: `tmux ls`","Re-resolve the pane target (list-panes) instead of reusing a cached pane id","If panes are frequently closing, review worker startup/keepalive logic"],"exampleFix":"// before\nawait sendLiteralTextOrThrow(resolveTarget, text);\n\n// after\ntry {\n  await sendLiteralTextOrThrow(resolveTarget, text);\n} catch (err) {\n  // pane may be gone: re-resolve or respawn worker\n  await respawnWorkerPane();\n  await sendLiteralTextOrThrow(freshResolveTarget, text);\n}","handlingStrategy":"retry","validationCode":"const panes = await runTmuxAsync(['list-panes', '-a', '-F', '#{pane_id}']);\nif (!panes.ok || !panes.stdout.includes(targetPaneId)) {\n  await respawnWorkerPane();\n}","typeGuard":null,"tryCatchPattern":"try { await sendLiteralTextOrThrow(resolveTarget, text); } catch (err) { if (/failed to send text/.test(String(err))) { await respawnWorkerPane(); await sendLiteralTextOrThrow(freshTarget, text); } else throw err; }","preventionTips":["Re-resolve pane targets immediately before each send","Watch the worker pane for close events and stop sending","Verify tmux availability with isTmuxAvailable() before operations"],"tags":["tmux","send-keys","pane-not-found","subprocess"],"backgroundTag":"tmux-pane-not-found","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}