{"record":{"id":"8396ed4b55faa6e9","repo":"stablyai/orca","slug":"timed-out-waiting-for-label-last-value-json","errorCode":null,"errorMessage":"Timed out waiting for ${label}; last value: ${JSON.stringify(lastValue)}","messagePattern":"Timed out waiting for (.+?); last value: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/linux-wayland-terminal-exercise.mjs","lineNumber":61,"sourceCode":"    delay(pollTimeoutMs).then(() => ({ timedOut: true, value: null }))\n  ])\n  if (result.timedOut) {\n    throw new Error(`Timed out polling ${label} after ${pollTimeoutMs}ms.`)\n  }\n  return result.value\n}\n\nasync function waitFor(label, read, timeout = terminalWaitTimeoutMs) {\n  const startedAt = Date.now()\n  let lastValue\n  while (Date.now() - startedAt < timeout) {\n    lastValue = await pollWithTimeout(label, read)\n    if (lastValue) {\n      return lastValue\n    }\n    await delay(50)\n  }\n  throw new Error(`Timed out waiting for ${label}; last value: ${JSON.stringify(lastValue)}`)\n}\n\nasync function getTerminalContent(page, charLimit = 12_000) {\n  return page.evaluate((limit) => {\n    const store = window.__store\n    if (!store || !window.__paneManagers) {\n      return ''\n    }\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","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/linux-wayland-terminal-exercise.mjs#L43-L79","documentation":"waitFor loops pollWithTimeout until the read returns a truthy value or terminalWaitTimeoutMs (45000ms) elapses, then throws including JSON.stringify of the last polled value for diagnosis. It is the outer budget for terminal-exercise conditions like 'renderer store exposure', 'workspace session hydration', 'active terminal PTY binding', and echo markers.","triggerScenarios":"The polled condition never becomes truthy within 45s: store never exposed, hydration failed, PTY never bound, terminal never echoed the expected marker, or a GPU stall slowed every poll.","commonSituations":"Renderer store not exposed in time; workspace session hydration failed; PTY binding broken; terminal echo missing because the shell didn't start; GPU wedge inflating every poll.","solutions":["Inspect lastValue in the message — it shows how far setup got (e.g. store present but not hydrated).","Check the phase logs printed before the throw to find the last successful step.","Verify repo registration and worktree hydration succeeded.","Only raise the 45s budget if the cause is transient; a persistent failure usually points to a real setup bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await waitFor(label, read, timeout)\n} catch (err) {\n  log.error(`waitFor '${label}' failed; lastValue=${err.message}`)\n  throw err\n}","preventionTips":["Always inspect lastValue in the message and the preceding phase logs to find how far setup progressed.","Confirm repo registration and hydration succeeded before assuming a timing budget issue."],"tags":["wayland","terminal","timeout"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}