{"record":{"id":"6093cc96e0bdd20f","repo":"openclaw/openclaw","slug":"viewport-label-exceeds-maximum-of-act-max-vie","errorCode":null,"errorMessage":"viewport ${label} exceeds maximum of ${ACT_MAX_VIEWPORT_DIMENSION}","messagePattern":"viewport (.+?) exceeds maximum of (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extensions/browser/src/browser/pw-tools-core.snapshot.ts","lineNumber":62,"sourceCode":"\nfunction resolveBoundedTimeoutMs(\n  timeoutMs: number | undefined,\n  fallbackMs: number,\n  minMs: number,\n  maxMs: number,\n): number {\n  const parsed = parseFiniteNumber(timeoutMs);\n  return Math.max(minMs, Math.min(maxMs, Math.floor(parsed ?? fallbackMs)));\n}\n\nfunction resolveSnapshotTimeoutMs(timeoutMs: number | undefined): number {\n  return resolveBoundedTimeoutMs(timeoutMs, 5_000, 500, 60_000);\n}\n\nfunction resolveViewportDimension(value: unknown, label: \"width\" | \"height\"): number {\n  const dimension = resolveIntegerOption(value, 1, { min: 1 });\n  if (dimension > ACT_MAX_VIEWPORT_DIMENSION) {\n    throw new Error(`viewport ${label} exceeds maximum of ${ACT_MAX_VIEWPORT_DIMENSION}`);\n  }\n  return dimension;\n}\n\nasync function collectSnapshotUrls(page: Page): Promise<SnapshotUrlEntry[]> {\n  const urls = await page\n    .evaluate(() => {\n      const seen = new Set<string>();\n      const out: SnapshotUrlEntry[] = [];\n      for (const anchor of Array.from(document.querySelectorAll(\"a[href]\"))) {\n        const href = anchor instanceof HTMLAnchorElement ? anchor.href : \"\";\n        if (!href || seen.has(href)) {\n          continue;\n        }\n        const text =\n          (anchor.textContent || anchor.getAttribute(\"aria-label\") || \"\")\n            .replace(/\\s+/g, \" \")\n            .trim()","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/browser/src/browser/pw-tools-core.snapshot.ts#L44-L80","documentation":"Thrown by resolveViewportDimension when a viewport width or height exceeds ACT_MAX_VIEWPORT_DIMENSION (currently 8192). Oversized viewports cause excessive memory allocation, rendering performance degradation, and potential Playwright/browser crashes. The same limit is enforced in the tool schema (optionalPositiveIntegerSchema with maximum) and the CLI resize path.","triggerScenarios":"Calling resizeViewportViaPlaywright or a snapshot with viewport options where width or height > 8192. Also triggered by device descriptors with extreme dimensions.","commonSituations":"Models or configs that pass very large numbers for viewport dimensions. Copy-paste errors where pixel values are multiplied incorrectly. Attempts to emulate 8K+ displays.","solutions":["Reduce the viewport dimension to 8192 or below.","Use a standard device descriptor via setDeviceViaPlaywright instead of manual dimensions.","Validate dimensions client-side: Math.min(8192, Math.max(1, value))."],"exampleFix":"// before\nawait resizeViewportViaPlaywright({ cdpUrl, targetId, width: 16384, height: 8192 });\n// after\nawait resizeViewportViaPlaywright({ cdpUrl, targetId, width: 8192, height: 8192 });","handlingStrategy":"validation","validationCode":"const ACT_MAX_VIEWPORT_DIMENSION = 8192;\nfunction validateViewportDimension(value: unknown, label: \"width\" | \"height\"): number {\n  const n = typeof value === \"number\" && Number.isFinite(value) ? Math.floor(value) : 0;\n  if (n < 1 || n > ACT_MAX_VIEWPORT_DIMENSION) {\n    throw new Error(`viewport ${label} must be between 1 and ${ACT_MAX_VIEWPORT_DIMENSION}`);\n  }\n  return n;\n}","typeGuard":"function isValidViewportDimension(value: unknown): value is number {\n  return typeof value === \"number\" && Number.isFinite(value) && value >= 1 && value <= 8192;\n}","tryCatchPattern":null,"preventionTips":["Clamp viewport dimensions to [1, 8192] before passing to resize or snapshot.","Prefer standard device descriptors over manual viewport dimensions.","Validate dimensions client-side to avoid hitting the runtime limit."],"tags":["browser","viewport","limit","validation","resize"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}