{"record":{"id":"1b75b583a1de76e4","repo":"stablyai/orca","slug":"no-active-terminal-pane-to-focus","errorCode":null,"errorMessage":"No active terminal pane to focus.","messagePattern":"No active terminal pane to focus\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/linux-wayland-terminal-exercise.mjs","lineNumber":115,"sourceCode":"\nasync function focusActiveTerminal(page) {\n  await runWithTimeout(\n    'active terminal focus',\n    () =>\n      page.evaluate(() => {\n        const store = window.__store\n        const state = store?.getState()\n        const worktreeId = state?.activeWorktreeId\n        const tabId =\n          state?.activeTabType === 'terminal'\n            ? state.activeTabId\n            : worktreeId\n              ? (state?.activeTabIdByWorktree?.[worktreeId] ?? null)\n              : null\n        const manager = tabId ? window.__paneManagers?.get(tabId) : null\n        const pane = manager?.getActivePane?.() ?? manager?.getPanes?.()[0] ?? null\n        if (!pane) {\n          throw new Error('No active terminal pane to focus.')\n        }\n        pane.terminal.focus()\n        pane.container.querySelector('.xterm-helper-textarea')?.focus()\n      }),\n    rendererActionTimeoutMs\n  )\n}\n\nexport async function setupTerminal(page, repoPath, logPhase) {\n  logPhase('setup.wait-store')\n  await waitFor('renderer store exposure', () => page.evaluate(() => Boolean(window.__store)))\n  logPhase('setup.wait-hydration')\n  await waitFor('workspace session hydration', () =>\n    page.evaluate(() => {\n      const state = window.__store?.getState?.()\n      return Boolean(state?.workspaceSessionReady && state?.hydrationSucceeded)\n    })\n  )","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/linux-wayland-terminal-exercise.mjs#L97-L133","documentation":"focusActiveTerminal resolves the active terminal pane by walking store state → activeTabId → window.__paneManagers.get(tabId) → getActivePane/getPanes, and throws if no pane is found before calling terminal.focus(). It runs inside runWithTimeout so a frozen evaluate surfaces as a timeout, while a missing pane surfaces as this error.","triggerScenarios":"The active tab is not a terminal, the tab id resolves to no pane manager, or the pane manager has no panes (terminal not yet mounted / torn down).","commonSituations":"Called before the terminal pane was mounted (PTY binding incomplete); activeTabType flipped away from 'terminal'; pane manager map missing the tab id.","solutions":["Ensure setupTerminal completed and the 'active terminal PTY binding' condition passed before focusing.","Confirm state.activeTabType === 'terminal' and state.activeTabId is set at the moment of focus.","Re-check window.__paneManagers has an entry for the active tab id."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const hasActivePane = () => page.evaluate(() => {\n  const state = window.__store?.getState?.()\n  const tabId = state?.activeTabType === 'terminal' ? state.activeTabId : null\n  const manager = tabId ? window.__paneManagers?.get(tabId) : null\n  return Boolean(manager?.getActivePane?.() ?? manager?.getPanes?.()[0])\n})\nif (!await hasActivePane()) throw new Error('cannot focus: no active terminal pane')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call focusActiveTerminal only after setupTerminal's 'active terminal PTY binding' condition passes.","Verify state.activeTabType === 'terminal' and the pane manager has the active tab id before focusing."],"tags":["wayland","terminal","renderer"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}