stablyai/orca · error · Error

No active terminal pane to focus.

Error message

No active terminal pane to focus.

What it means

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.

Source

Thrown at config/scripts/linux-wayland-terminal-exercise.mjs:115

async function focusActiveTerminal(page) {
  await runWithTimeout(
    'active terminal focus',
    () =>
      page.evaluate(() => {
        const store = window.__store
        const state = store?.getState()
        const worktreeId = state?.activeWorktreeId
        const tabId =
          state?.activeTabType === 'terminal'
            ? state.activeTabId
            : worktreeId
              ? (state?.activeTabIdByWorktree?.[worktreeId] ?? null)
              : null
        const manager = tabId ? window.__paneManagers?.get(tabId) : null
        const pane = manager?.getActivePane?.() ?? manager?.getPanes?.()[0] ?? null
        if (!pane) {
          throw new Error('No active terminal pane to focus.')
        }
        pane.terminal.focus()
        pane.container.querySelector('.xterm-helper-textarea')?.focus()
      }),
    rendererActionTimeoutMs
  )
}

export async function setupTerminal(page, repoPath, logPhase) {
  logPhase('setup.wait-store')
  await waitFor('renderer store exposure', () => page.evaluate(() => Boolean(window.__store)))
  logPhase('setup.wait-hydration')
  await waitFor('workspace session hydration', () =>
    page.evaluate(() => {
      const state = window.__store?.getState?.()
      return Boolean(state?.workspaceSessionReady && state?.hydrationSucceeded)
    })
  )

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Ensure setupTerminal completed and the 'active terminal PTY binding' condition passed before focusing.
  2. Confirm state.activeTabType === 'terminal' and state.activeTabId is set at the moment of focus.
  3. Re-check window.__paneManagers has an entry for the active tab id.
Defensive patterns

Strategy: type-guard

Validate before calling

const hasActivePane = () => page.evaluate(() => {
  const state = window.__store?.getState?.()
  const tabId = state?.activeTabType === 'terminal' ? state.activeTabId : null
  const manager = tabId ? window.__paneManagers?.get(tabId) : null
  return Boolean(manager?.getActivePane?.() ?? manager?.getPanes?.()[0])
})
if (!await hasActivePane()) throw new Error('cannot focus: no active terminal pane')

Prevention

When it happens

Trigger: 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).

Common situations: Called before the terminal pane was mounted (PTY binding incomplete); activeTabType flipped away from 'terminal'; pane manager map missing the tab id.

Related errors


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