stablyai/orca · error · Error

window.__store is not available.

Error message

window.__store is not available.

What it means

During repo registration, after window.api.repos.add succeeds the code reads window.__store to drive fetchRepos/fetchWorktrees; it throws if the store is not exposed. This runs inside runWithTimeout, but a missing store throws synchronously within the evaluate rather than timing out.

Source

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

  logPhase('setup.wait-hydration')
  await waitFor('workspace session hydration', () =>
    page.evaluate(() => {
      const state = window.__store?.getState?.()
      return Boolean(state?.workspaceSessionReady && state?.hydrationSucceeded)
    })
  )
  logPhase('setup.add-repo')
  const repoId = await runWithTimeout(
    'repo registration',
    () =>
      page.evaluate(async (pathToAdd) => {
        const result = await window.api.repos.add({ path: pathToAdd, kind: 'git' })
        if ('error' in result) {
          throw new Error(result.error)
        }
        const store = window.__store
        if (!store) {
          throw new Error('window.__store is not available.')
        }
        await store.getState().fetchRepos()
        await store.getState().fetchWorktrees(result.repo.id, { requireAuthoritative: true })
        return result.repo.id
      }, repoPath),
    rendererSetupTimeoutMs
  )

  // Why: startup hydration can reset activeWorktreeId; after it completes, set
  // worktree, tab, and visible type in one renderer transaction for CI setup.
  logPhase('setup.activate-worktree')
  await waitFor('active terminal workspace setup', () =>
    page.evaluate((id) => {
      const store = window.__store
      if (!store) {
        return false
      }
      let state = store.getState()

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Confirm the 'renderer store exposure' and 'workspace session hydration' waitFor conditions passed before repo registration.
  2. Check that window.__store is still assigned at the moment of registration (not cleared by a reload).
  3. Investigate a preload/renderer change that delayed store exposure.
Defensive patterns

Strategy: type-guard

Validate before calling

const storeReady = await page.evaluate(() => Boolean(window.__store))
if (!storeReady) throw new Error('window.__store not exposed; renderer not ready for repo registration')

Prevention

When it happens

Trigger: window.__store is not yet assigned when repos.add resolves; a timing regression where store exposure lags behind API readiness.

Common situations: Store exposure race after a preload/renderer change; the 'renderer store exposure' waitFor passed earlier but the store was later reset; renderer reloaded mid-setup.

Related errors


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