stablyai/orca · error · Error

Unable to determine full-page screenshot bounds

Error message

Unable to determine full-page screenshot bounds

What it means

getLayoutClip() extracts content dimensions from Page.getLayoutMetrics to build the screenshot clip rectangle. If neither cssContentSize nor contentSize has valid finite positive width and height, it returns null and captureFullPageScreenshot() aborts. This is the same semantic as error 804 (in CdpBridge) but in the standalone module — it throws a plain Error without a BrowserError code. The cssContentSize preference avoids HiDPI device-pixel tiling on Retina displays.

Source

Thrown at src/main/browser/cdp-screenshot.ts:157

  }
  const dbg = webContents.debugger
  if (!dbg.isAttached()) {
    throw new Error('Debugger not attached')
  }

  try {
    webContents.invalidate()
  } catch {
    // Some guest teardown paths reject repaint requests. Fall through to CDP.
  }

  const metrics = await sendCommandWithTimeout<{
    cssContentSize?: { width?: number; height?: number }
    contentSize?: { width?: number; height?: number }
  }>(webContents, 'Page.getLayoutMetrics', undefined, SCREENSHOT_TIMEOUT_MESSAGE)
  const clip = getLayoutClip(metrics)
  if (!clip) {
    throw new Error('Unable to determine full-page screenshot bounds')
  }

  const { data } = await sendCommandWithTimeout<{ data: string }>(
    webContents,
    'Page.captureScreenshot',
    {
      format,
      captureBeyondViewport: true,
      clip
    },
    SCREENSHOT_TIMEOUT_MESSAGE
  )

  return { data, format }
}

// Why: Electron's capturePage() is unreliable on webview guests — the compositor
// may not produce frames when the webview panel is inactive, unfocused, or in a

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Ensure the page has loaded with visible, laid-out content before screenshotting.
  2. Retry after waitForLoad or a short delay to allow layout to settle.
  3. Avoid screenshotting about:blank, chrome://, or other internal pages with no content layout.
Defensive patterns

Strategy: validation

Validate before calling

const url = webContents.getURL()
if (!url || url.startsWith('about:') || url.startsWith('chrome:')) {
  throw new Error('Cannot determine screenshot bounds for internal page — navigate to real content first')
}
const result = await captureFullPageScreenshot(webContents, format)

Try / catch

try {
  return await captureFullPageScreenshot(wc, format)
} catch (e) {
  if (e instanceof Error && /bounds/.test(e.message)) {
    // page has no layout; wait for load and retry, or navigate to real content
    await new Promise(r => setTimeout(r, 500))
    return await captureFullPageScreenshot(wc, format)
  }
  throw e
}

Prevention

When it happens

Trigger: Screenshotting about:blank, a crashed renderer, or a page before its first paint/layout cycle; pages with zero-size content area (empty iframe, blank document).

Common situations: Internal pages (about:, chrome:); racing with navigation (screenshot before load); renderer crash; empty or display:none content.

Related errors


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