{"record":{"id":"9fa009f105131619","repo":"pbakaus/impeccable","slug":"impeccable-shader-bitmap-decode-failed","errorCode":null,"errorMessage":"[impeccable] shader bitmap decode failed:","messagePattern":"\\[impeccable\\] shader bitmap decode failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"skill/scripts/live-browser.js","lineNumber":8870,"sourceCode":"  // (which returns null when the element paints its own bg), this always returns\n  // a usable color: the element's own background if any, else the nearest opaque\n  // ancestor, else the paper fallback.\n  // Rasterize any CSS color (oklch, color(), named, hex, rgb) through a 1x1\n  // canvas and read back the sRGB pixel. String-parsing computed colors is a\n  // trap: Chrome returns backgroundColor as oklch()/color() for oklch inputs,\n  // which a hex/rgb regex misses - every site token would fall back to white.\n  let colorParseCtx = null;\n  function cssColorToRgb01(str) {\n    if (!colorParseCtx) {\n      colorParseCtx = document.createElement('canvas').getContext('2d', { willReadFrequently: true });\n    }\n    // Clear first: the ctx is cached across calls, so a semi-transparent color\n    // would otherwise blend (source-over) with the previous call's leftover\n    // pixel, making the result depend on call history.\n    colorParseCtx.clearRect(0, 0, 1, 1);\n    colorParseCtx.fillStyle = '#000'; // invalid input leaves this default\n    colorParseCtx.fillStyle = str;\n    colorParseCtx.fillRect(0, 0, 1, 1);\n    const d = colorParseCtx.getImageData(0, 0, 1, 1).data;\n    return [d[0] / 255, d[1] / 255, d[2] / 255];\n  }\n  function resolvePaperRgb(el) {\n    let node = el;\n    while (node) {\n      const bg = getComputedStyle(node).backgroundColor;\n      if (!isTransparentColor(bg)) return cssColorToRgb01(bg);\n      node = node.parentElement;\n    }\n    return SHADER_PAPER_FALLBACK;\n  }\n\n  // When an element is transparent up to the root, its visible backdrop can\n  // still come from an ancestor's background-image or a covering positioned\n  // layer that is a *child* of an ancestor (e.g. a hero's absolute art div) -\n  // neither of which the ancestor background-COLOR walk can see. Return the\n  // nearest such ancestor so we can capture it and crop, embedding the real","sourceCodeStart":8852,"sourceCodeEnd":8888,"githubUrl":"https://github.com/pbakaus/impeccable/blob/f2c7051853848826aac2f4646581d62a732155ad/skill/scripts/live-browser.js#L8852-L8888","documentation":"After the shader overlay's GL setup succeeds, the captured screenshot blob is decoded with createImageBitmap before texture upload. If decoding rejects — empty/corrupt blob from a racing capture, decode OOM, browser quirk — the code logs 'shader bitmap decode failed:', force-loses the WebGL context via WEBGL_lose_context, and shows showShaderBitmapFallback: a static, non-GL rendering of the same image.","triggerScenarios":"The blob passed in is empty or truncated because capture raced DOM teardown (see the capture-failed path); image decode under memory pressure; browsers with partial createImageBitmap support for PNG blobs.","commonSituations":"See trigger scenarios.","solutions":["No action needed — the static fallback shows the same screenshot","If this recurs, chase the upstream capture path (a decode failure usually means the blob was never valid)","Retry the generate to get a fresh capture and a working animated overlay"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if (!blob || blob.size === 0) { showShaderBitmapFallback(canvas, blob); return; } // skip decode for empty blobs","typeGuard":null,"tryCatchPattern":"try { bitmap = await createImageBitmap(blob); } catch (err) { console.warn(err); gl.getExtension?.('WEBGL_lose_context')?.loseContext(); showShaderBitmapFallback(canvas, blob); return; }","preventionTips":["Validate the blob exists and is non-empty before decoding","Investigate recurring decode failures upstream — they usually trace to a racing capture","Keep the static fallback path tested so degrade-to-image is always available"],"tags":["createimagebitmap","webgl","shader-overlay","image-decode"],"backgroundTag":"image-decode-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"}