{"record":{"id":"10325a3af9777bea","repo":"stablyai/orca","slug":"window-store-is-not-available","errorCode":null,"errorMessage":"window.__store is not available.","messagePattern":"window\\.__store is not available\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/linux-wayland-terminal-exercise.mjs","lineNumber":145,"sourceCode":"  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  )\n  logPhase('setup.add-repo')\n  const repoId = await runWithTimeout(\n    'repo registration',\n    () =>\n      page.evaluate(async (pathToAdd) => {\n        const result = await window.api.repos.add({ path: pathToAdd, kind: 'git' })\n        if ('error' in result) {\n          throw new Error(result.error)\n        }\n        const store = window.__store\n        if (!store) {\n          throw new Error('window.__store is not available.')\n        }\n        await store.getState().fetchRepos()\n        await store.getState().fetchWorktrees(result.repo.id, { requireAuthoritative: true })\n        return result.repo.id\n      }, repoPath),\n    rendererSetupTimeoutMs\n  )\n\n  // Why: startup hydration can reset activeWorktreeId; after it completes, set\n  // worktree, tab, and visible type in one renderer transaction for CI setup.\n  logPhase('setup.activate-worktree')\n  await waitFor('active terminal workspace setup', () =>\n    page.evaluate((id) => {\n      const store = window.__store\n      if (!store) {\n        return false\n      }\n      let state = store.getState()","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/linux-wayland-terminal-exercise.mjs#L127-L163","documentation":"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.","triggerScenarios":"window.__store is not yet assigned when repos.add resolves; a timing regression where store exposure lags behind API readiness.","commonSituations":"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.","solutions":["Confirm the 'renderer store exposure' and 'workspace session hydration' waitFor conditions passed before repo registration.","Check that window.__store is still assigned at the moment of registration (not cleared by a reload).","Investigate a preload/renderer change that delayed store exposure."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const storeReady = await page.evaluate(() => Boolean(window.__store))\nif (!storeReady) throw new Error('window.__store not exposed; renderer not ready for repo registration')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate repo registration behind the 'renderer store exposure' and 'workspace session hydration' waitFor conditions.","After a preload/renderer change, recheck that window.__store is still assigned before driving store actions."],"tags":["wayland","renderer","store"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}