Yeachan-Heo/oh-my-codex · error

Question UI session ${target} disappeared immediately after

Error message

Question UI session ${target} disappeared immediately after launch.

What it means

The tmux-based question renderer launched a tmux session for the question UI, waited a settle period, then verified via isLaunchedQuestionSessionAlive that the session still exists. The session vanished immediately, so the renderer treats the launch as failed. This usually means the command inside the tmux session exited instantly (bad command, missing binary, or immediate error output).

Source

Thrown at src/question/renderer.ts:1004

    });
    const baseName = basename(options.recordPath, '.json').replace(/[^A-Za-z0-9_-]+/g, '-').slice(0, 32) || 'question';
    const sessionName = `omx-question-${baseName}`;
    const output = execTmux([
      'new-session',
      '-d',
      '-P',
      '-F',
      '#{session_name}',
      '-s',
      sessionName,
      '-c',
      options.cwd,
      ...commandArgs,
    ]).trim();
    const target = output || sessionName;
    sleepImpl(QUESTION_RENDERER_SESSION_SETTLE_MS);
    if (!isLaunchedQuestionSessionAlive(target, execTmux)) {
      throw new Error(`Question UI session ${target} disappeared immediately after launch.`);
    }
    return {
      renderer: 'tmux-session',
      target,
      launched_at: launchedAt,
    };
  }

  if (strategy === 'test-noop') {
    return {
      renderer: 'tmux-session',
      target: 'test-noop-renderer',
      launched_at: launchedAt,
    };
  }

  const exhaustiveStrategy: never = strategy;
  throw new Error(`Unsupported omx question renderer strategy: ${exhaustiveStrategy}`);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Verify the command and args passed to the tmux session run successfully standalone (run them in a shell first)
  2. Check `tmux list-sessions` right after launch to see whether the session exists under the expected name and inspect `tmux capture-pane` output for an early error
  3. Ensure the session name is unique per launch to avoid collisions with dead sessions
  4. If the environment has no usable tmux (CI, containers), switch to a different renderer strategy or a test/noop renderer

Example fix

// before
const r = await launchQuestionRenderer({ renderer: 'tmux-session', command: 'omx-ui', options });
// after
// verify the command works first
const ok = await probeCommand('omx-ui', options.cwd);
if (!ok) throw new Error('omx-ui not runnable; check PATH/cwd');
const r = await launchQuestionRenderer({ renderer: 'tmux-session', command: 'omx-ui', options });
Defensive patterns

Strategy: validation

Validate before calling

const out = execSync('tmux has-session -t ' + shellQuote(target)); // or probe the UI command exists
if (!commandExists(uiCommand, options.cwd)) throw new Error('UI command not runnable');

Type guard

function isRunnableRendererOpts(o: LaunchOpts): boolean {
  return typeof o.command === 'string' && o.command.length > 0 && !!o.options?.cwd;
}

Try / catch

try { return await launch(opts); } catch (e) { if (/disappeared immediately/.test((e as Error).message)) { await diagnoseTmuxSession(target); throw new Error(`tmux renderer failed: inspect session ${target}`); } throw e; }

Prevention

When it happens

Trigger: Calling the question renderer launch API with renderer strategy 'tmux-session' where execTmux spawns a session whose command exits immediately; e.g. the UI binary path is wrong, tmux kill-session ran concurrently, or the session name collided with an existing dead session.

Common situations: Missing or misconfigured UI binary in options.cwd; tmux server killing the session due to a duplicate name; CI environments without a usable tmux server or TTY; the command printing an error and exiting before the settle delay elapses.

Related errors


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