{"record":{"id":"ebb777f267883cfd","repo":"stablyai/orca","slug":"ibus-daemon-exited-early-with-code-ibusprocess-e","errorCode":null,"errorMessage":"ibus-daemon exited early with code ${ibusProcess.exitCode}","messagePattern":"ibus-daemon exited early with code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-terminal-ibus-hangul-e2e.mjs","lineNumber":104,"sourceCode":"    ['initial-input-mode', 'hangul'],\n    ['hangul-keyboard', '2']\n  ]) {\n    const result = spawnSync(\n      'gsettings',\n      ['set', 'org.freedesktop.ibus.engine.hangul', key, value],\n      { encoding: 'utf8' }\n    )\n    if (result.status !== 0) {\n      throw new Error(`Failed to configure IBus Hangul ${key}: ${result.stderr.trim()}`)\n    }\n  }\n}\n\nasync function waitForHangulEngine(ibusProcess) {\n  const deadline = Date.now() + 15_000\n  while (Date.now() < deadline) {\n    if (ibusProcess.exitCode !== null) {\n      throw new Error(`ibus-daemon exited early with code ${ibusProcess.exitCode}`)\n    }\n    const result = spawnSync('ibus', ['engine', 'hangul'], { stdio: 'pipe' })\n    if (result.status === 0) {\n      return\n    }\n    await delay(100)\n  }\n  throw new Error('Timed out while selecting the IBus Hangul engine')\n}\n\nasync function runInsideSession(evidenceDir) {\n  const ibusLogPath = path.join(evidenceDir, 'ibus-daemon.log')\n  const ibusLogFd = openSync(ibusLogPath, 'w')\n  const windowManagerLogPath = path.join(evidenceDir, 'xfwm4.log')\n  const windowManagerLogFd = openSync(windowManagerLogPath, 'w')\n  const evidence = {\n    display: process.env.DISPLAY ?? null,\n    ibusDaemonPid: null,","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-terminal-ibus-hangul-e2e.mjs#L86-L122","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read test-results/terminal-ibus-hangul-native-ibus-daemon.log (or the evidence dir copy) for the daemon's fatal message.","Confirm only one ibus-daemon is running for the session — kill stragglers (pkill -u $USER ibus-daemon) before re-running.","Verify ibus-hangul is installed and `ibus list-engine` shows the hangul engine.","Check DISPLAY and XDG_RUNTIME_DIR are set inside the isolated X11 session env passed to the daemon."],"exampleFix":"// diagnose\nibus list-engine | grep hangul\ncat test-results/terminal-ibus-hangul-native-ibus-daemon.log\n// fix: remove stale config and reinstall engine\nrm -rf ~/.config/ibus\nsudo apt-get install --reinstall ibus-hangul","handlingStrategy":"try-catch","validationCode":"// preflight: ensure no stale daemon and the binary exists\nconst { spawnSync } = require('node:child_process')\nspawnSync('pkill', ['-u', process.env.USER, 'ibus-daemon'], { stdio: 'ignore' })\nif (spawnSync('which', ['ibus-daemon']).status !== 0) {\n  console.error('ibus-daemon not on PATH'); process.exit(1)\n}","typeGuard":"function isAlive(child: { exitCode: number | null }): boolean {\n  return child.exitCode === null\n}","tryCatchPattern":"try {\n  await waitForHangulEngine(ibusProcess)\n} catch (err) {\n  if (/exited early/.test(String(err))) {\n    console.error('ibus-daemon crashed — see ibus-daemon.log')\n  }\n  throw err\n}","preventionTips":["Capture ibus-daemon stdout/stderr to a log from the start so crash causes are recoverable.","Kill stale ibus-daemon instances before spawning a new one.","Pin a known-good ibus/ibus-hangul version in the CI image."],"tags":["ibus","ime","process-crash","linux","e2e"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}