Yeachan-Heo/oh-my-codex · error

omx question cannot open a visible renderer because this tmu

Error message

omx question cannot open a visible renderer because this tmux session has no attached client. Run omx question from an attached tmux pane.

What it means

Even when TMUX is set (strategy inside-tmux), the session must have at least one attached client for a visible split pane to make sense. isCurrentTmuxSessionAttached is checked against the return target or TMUX_PANE; if no client is attached, the renderer throws because the user would never see the question UI.

Source

Thrown at src/question/renderer.ts:868

      excludeRecordPath: options.recordPath,
      nowIso: launchedAt,
    });
    return launchWindowsPsmuxShellQuestionPane(execTmux, sleepImpl, options.recordPath, {
      cwd: options.cwd,
      env: options.env,
      sessionId: options.sessionId,
      returnTarget,
      launchedAt,
    });
  }

  if (strategy === 'inside-tmux') {
    const splitTarget = returnTarget ? ['-t', returnTarget] : [];
    const attachedCheckTarget = safeString(env.TMUX).trim()
      ? returnTarget || safeString(env.TMUX_PANE).trim() || undefined
      : undefined;
    if (safeString(env.TMUX).trim() && !isCurrentTmuxSessionAttached(execTmux, env, attachedCheckTarget)) {
      throw new Error(
        'omx question cannot open a visible renderer because this tmux session has no attached client. Run omx question from an attached tmux pane.',
      );
    }

    supersedeLiveQuestionsForSession(options.cwd, options.sessionId, execTmux, {
      excludeRecordPath: options.recordPath,
      nowIso: launchedAt,
    });

    const sizingTarget = returnTarget || safeString(env.TMUX_PANE).trim() || undefined;
    const availableWidthInfo = resolveAvailablePaneWidth(execTmux, sizingTarget);
    const newWindowTarget = resolveNewWindowTarget(execTmux, returnTarget);
    const newWindowTargetArgs = newWindowTarget ? ['-t', newWindowTarget] : [];
    if (sizingTarget && availableWidthInfo.probeFailed) {
      return launchQuestionPane(
        execTmux,
        sleepImpl,
        [

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Attach a client to the session: `tmux attach-session -t <session>` (from another terminal).
  2. Run omx question only while you are actively viewing the tmux session.
  3. For automation, set OMX_QUESTION_RETURN_PANE to a pane in an attached session, or use a non-interactive question mode.

Example fix

# before
tmux new-session -d -s work
# ...later, omx question fails: session has no attached client

# after
# from another terminal:
tmux attach -t work
# then run omx question inside that pane
Defensive patterns

Strategy: validation

Validate before calling

function sessionAttached(): boolean {
  try {
    const out = execFileSync('tmux', ['list-sessions', '-F', '#{session_name}:#{session_attached}'], { encoding: 'utf-8' });
    const mine = process.env.TMUX?.split(',').pop();
    return out.split('\n').some(l => { const [name, att] = l.split(':'); return att === '1' && (!mine || name === mine); });
  } catch { return false; }
}

Try / catch

try { launchQuestionRenderer(opts); } catch (e) { if (e instanceof Error && /no attached client/.test(e.message)) { /* ask user to `tmux attach`, then retry once */ } else throw e; }

Prevention

When it happens

Trigger: Running inside a tmux session that was created detached (tmux new-session -d) and entered via `tmux send-keys`/automation; sessions where all clients detached while the process kept running; a switch-client state that reports no attached client for the target session.

Common situations: Automation/agent harnesses that drive tmux programmatically without attaching; long-running omx processes that survive a detach; scripts using new-session -d as a job runner.

Related errors


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