pbakaus/impeccable · info

[impeccable] Svelte ancestor crop capture failed, falling…

Error message

[impeccable] Svelte ancestor crop capture failed, falling back to element capture:

What it means

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.

Solutions

  1. No action usually needed — the element-level fallback capture is taken automatically
  2. If the fallback's background/paper looks wrong, capture from a plainer ancestor or fix cross-origin CORS headers on images/fonts
  3. Reduce window scale (device pixel ratio cap is already 2) for gigantic ancestors
Defensive patterns

Strategy: fallback

Validate before calling

// Cap the ancestor render size before attempting crop capture
const MAX = 4096;
const scale = Math.min(window.devicePixelRatio || 1, 2, MAX / Math.max(ancestorRect.width, ancestorRect.height));

Try / catch

try { return await captureElementFromRenderedAncestor(ms, el, opts); } catch (err) { console.warn(err); /* fall through to direct element capture */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of pbakaus/impeccable@f2c7051853 (2026-08-18). Data as JSON: /api/errors/51a0ea397bf4ea95. Report an issue: GitHub.

Appendix: source

Thrown at skill/scripts/live-browser.js:8444

    let binary = '';
    const CHUNK = 0x8000;
    for (let i = 0; i < bytes.length; i += CHUNK) {
      binary += String.fromCharCode.apply(null, bytes.subarray(i, i + CHUNK));
    }
    return btoa(binary);
  }
  async function inlineFontUrls(cssText) {
    const urlRe = /url\((['"]?)(https?:\/\/[^'")\s]+)\1\)/g;
    const urls = new Set();
    let m;
    while ((m = urlRe.exec(cssText))) {
      if (FONT_EXT_RE.test(m[2])) urls.add(m[2]);
    }
    const map = new Map();
    await Promise.all([...urls].map(async (url) => {
      try {
        const res = await fetch(url);
        if (!res.ok) return;
        const buf = await res.arrayBuffer();
        const ext = url.toLowerCase().match(FONT_EXT_RE)?.[1] || 'woff2';
        const mime = FONT_MIME[ext] || 'application/octet-stream';
        map.set(url, 'data:' + mime + ';base64,' + bufferToBase64(buf));
      } catch { /* skip; fall through to URL */ }
    }));
    return cssText.replace(urlRe, (orig, q, url) => {
      const data = map.get(url);
      return data ? 'url(' + q + data + q + ')' : orig;
    });
  }
  async function collectFontCssText() {
    const chunks = [];
    const fontFaceRe = /@font-face\s*\{[^}]*\}/g;
    for (const sheet of document.styleSheets) {
      try {
        const rules = sheet.cssRules;
        for (const rule of rules) {

View on GitHub (pinned to f2c7051853)