stablyai/orca · error · Error

ibus-daemon exited early with code ${ibusProcess.exitCode}

Error message

ibus-daemon exited early with code ${ibusProcess.exitCode}

What it means

waitForHangulEngine() polls `ibus engine hangul` for up to 15s, but first checks whether the spawned ibus-daemon process has exited. A non-null exitCode means the daemon crashed or was killed during startup, so waiting further is pointless. The exit code is reported to point at the crash cause (missing plugin, config error, display gone).

Source

Thrown at config/scripts/run-terminal-ibus-hangul-e2e.mjs:104

    ['initial-input-mode', 'hangul'],
    ['hangul-keyboard', '2']
  ]) {
    const result = spawnSync(
      'gsettings',
      ['set', 'org.freedesktop.ibus.engine.hangul', key, value],
      { encoding: 'utf8' }
    )
    if (result.status !== 0) {
      throw new Error(`Failed to configure IBus Hangul ${key}: ${result.stderr.trim()}`)
    }
  }
}

async function waitForHangulEngine(ibusProcess) {
  const deadline = Date.now() + 15_000
  while (Date.now() < deadline) {
    if (ibusProcess.exitCode !== null) {
      throw new Error(`ibus-daemon exited early with code ${ibusProcess.exitCode}`)
    }
    const result = spawnSync('ibus', ['engine', 'hangul'], { stdio: 'pipe' })
    if (result.status === 0) {
      return
    }
    await delay(100)
  }
  throw new Error('Timed out while selecting the IBus Hangul engine')
}

async function runInsideSession(evidenceDir) {
  const ibusLogPath = path.join(evidenceDir, 'ibus-daemon.log')
  const ibusLogFd = openSync(ibusLogPath, 'w')
  const windowManagerLogPath = path.join(evidenceDir, 'xfwm4.log')
  const windowManagerLogFd = openSync(windowManagerLogPath, 'w')
  const evidence = {
    display: process.env.DISPLAY ?? null,
    ibusDaemonPid: null,

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Read test-results/terminal-ibus-hangul-native-ibus-daemon.log (or the evidence dir copy) for the daemon's fatal message.
  2. Confirm only one ibus-daemon is running for the session — kill stragglers (pkill -u $USER ibus-daemon) before re-running.
  3. Verify ibus-hangul is installed and `ibus list-engine` shows the hangul engine.
  4. Check DISPLAY and XDG_RUNTIME_DIR are set inside the isolated X11 session env passed to the daemon.

Example fix

// diagnose
ibus list-engine | grep hangul
cat test-results/terminal-ibus-hangul-native-ibus-daemon.log
// fix: remove stale config and reinstall engine
rm -rf ~/.config/ibus
sudo apt-get install --reinstall ibus-hangul
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: ensure no stale daemon and the binary exists
const { spawnSync } = require('node:child_process')
spawnSync('pkill', ['-u', process.env.USER, 'ibus-daemon'], { stdio: 'ignore' })
if (spawnSync('which', ['ibus-daemon']).status !== 0) {
  console.error('ibus-daemon not on PATH'); process.exit(1)
}

Type guard

function isAlive(child: { exitCode: number | null }): boolean {
  return child.exitCode === null
}

Try / catch

try {
  await waitForHangulEngine(ibusProcess)
} catch (err) {
  if (/exited early/.test(String(err))) {
    console.error('ibus-daemon crashed — see ibus-daemon.log')
  }
  throw err
}

Prevention

When it happens

Trigger: ibus-daemon is spawned (line ~149) and terminates before the Hangul engine becomes selectable — e.g. it cannot load ibus-hangul, cannot reach the X display, or hits a config error logged to ibus-daemon.log.

Common situations: ibus-hangul plugin missing or incompatible version; DISPLAY/XDG_RUNTIME_DIR misconfigured; stale ibus config from a prior user session; the daemon conflicts with an already-running ibus-daemon on the same session bus.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/ebb777f267883cfd. Report an issue: GitHub.