{"record":{"id":"51a0ea397bf4ea95","repo":"pbakaus/impeccable","slug":"impeccable-svelte-ancestor-crop-capture-failed","errorCode":null,"errorMessage":"[impeccable] Svelte ancestor crop capture failed, falling back to element capture:","messagePattern":"\\[impeccable\\] Svelte ancestor crop capture failed, falling back to element capture:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"skill/scripts/live-browser.js","lineNumber":8444,"sourceCode":"    let binary = '';\n    const CHUNK = 0x8000;\n    for (let i = 0; i < bytes.length; i += CHUNK) {\n      binary += String.fromCharCode.apply(null, bytes.subarray(i, i + CHUNK));\n    }\n    return btoa(binary);\n  }\n  async function inlineFontUrls(cssText) {\n    const urlRe = /url\\((['\"]?)(https?:\\/\\/[^'\")\\s]+)\\1\\)/g;\n    const urls = new Set();\n    let m;\n    while ((m = urlRe.exec(cssText))) {\n      if (FONT_EXT_RE.test(m[2])) urls.add(m[2]);\n    }\n    const map = new Map();\n    await Promise.all([...urls].map(async (url) => {\n      try {\n        const res = await fetch(url);\n        if (!res.ok) return;\n        const buf = await res.arrayBuffer();\n        const ext = url.toLowerCase().match(FONT_EXT_RE)?.[1] || 'woff2';\n        const mime = FONT_MIME[ext] || 'application/octet-stream';\n        map.set(url, 'data:' + mime + ';base64,' + bufferToBase64(buf));\n      } catch { /* skip; fall through to URL */ }\n    }));\n    return cssText.replace(urlRe, (orig, q, url) => {\n      const data = map.get(url);\n      return data ? 'url(' + q + data + q + ')' : orig;\n    });\n  }\n  async function collectFontCssText() {\n    const chunks = [];\n    const fontFaceRe = /@font-face\\s*\\{[^}]*\\}/g;\n    for (const sheet of document.styleSheets) {\n      try {\n        const rules = sheet.cssRules;\n        for (const rule of rules) {","sourceCodeStart":8426,"sourceCodeEnd":8462,"githubUrl":"https://github.com/pbakaus/impeccable/blob/f2c7051853848826aac2f4646581d62a732155ad/skill/scripts/live-browser.js#L8426-L8462","documentation":"When an element is captured via an ancestor-crop shader proxy, live-browser first renders the ancestor with modern-screenshot and crops out the element (inside hideCaptureChromeForShaderProxy). If that ancestor render throws — canvas size limits, tainted cross-origin content, renderer unsupported styles — the error is logged as 'ancestor crop capture failed, falling back to element capture:' and a direct capture of the element itself is used instead, so the generate flow continues.","triggerScenarios":"The proxy ancestor is enormous (viewport-sized hero at DPR 2 exceeding max canvas/texture size); ancestor contains cross-origin images or fonts that taint the canvas; modern-screenshot hits an unimplemented CSS feature inside the ancestor.","commonSituations":"Capturing an element inside a full-bleed hero with video/background-image art; very high pixel-ratio displays; pages pulling cross-origin assets without CORS headers.","solutions":["No action usually needed — the element-level fallback capture is taken automatically","If the fallback's background/paper looks wrong, capture from a plainer ancestor or fix cross-origin CORS headers on images/fonts","Reduce window scale (device pixel ratio cap is already 2) for gigantic ancestors"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Cap the ancestor render size before attempting crop capture\nconst MAX = 4096;\nconst scale = Math.min(window.devicePixelRatio || 1, 2, MAX / Math.max(ancestorRect.width, ancestorRect.height));","typeGuard":null,"tryCatchPattern":"try { return await captureElementFromRenderedAncestor(ms, el, opts); } catch (err) { console.warn(err); /* fall through to direct element capture */ }","preventionTips":["Serve images/fonts with CORS headers so the ancestor render is not tainted","Keep the shader-proxy ancestor reasonably sized; avoid viewport-wide proxies at DPR 2","Trust the built-in fallback: an element-level capture is always preferable to no capture"],"tags":["screenshot","modern-screenshot","canvas","fallback","svelte-preview"],"backgroundTag":"screenshot-capture-failed","analyzedSha":"f2c7051853848826aac2f4646581d62a732155ad","analyzedAt":"2026-08-18T04:58:36.608Z","contentChangedAt":"2026-08-18T04:58:36.608Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}