{"record":{"id":"87ba36df612777bb","repo":"pbakaus/impeccable","slug":"impeccable-shader-resume-failed","errorCode":null,"errorMessage":"[impeccable] shader resume failed:","messagePattern":"\\[impeccable\\] shader resume failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"skill/scripts/live-browser.js","lineNumber":9715,"sourceCode":"      origin: sessionOrigin || undefined,\n      insertPlaceholder: insertPlaceholderSnapshot || undefined,\n      pickedAnchor: pickedAnchorSnapshot || undefined,\n      pickedAnchorViewportTop: Number.isFinite(pickedAnchorViewportTop) ? pickedAnchorViewportTop : undefined,\n      pageHash: location.hash || undefined,\n      pageSearch: location.search || undefined,\n    });\n  }\n\n  function loadSession() {\n    const saved = sessionState.loadSession();\n    // localStorage is per-origin, and two projects routinely reuse the same\n    // localhost port. A saved session stamped with another project's appRoot\n    // is that project's leftover, never a session this server can complete;\n    // resuming it freezes the picker behind an unfinishable banner.\n    if (saved?.appRoot && APP_ROOT && saved.appRoot !== APP_ROOT) {\n      console.warn('[impeccable] Ignoring saved live session from another project (' + saved.appRoot + ').');\n      sessionState.clearSession();\n      return null;\n    }\n    return saved;\n  }\n\n  function clearSession() {\n    sessionState.clearSession();\n  }\n\n  /** Mark session as handled (accepted/discarded). The agent will clean up\n   *  the source, but until it does the wrapper is still in the HTML. This\n   *  prevents resumeSession from picking it up again after reload. */\n  function markSessionHandled() {\n    if (!currentSessionId) return;\n    sessionState.markHandled(currentSessionId);\n  }\n\n  function isSessionHandled(id) {\n    return sessionState.isHandled(id);","sourceCodeStart":9697,"sourceCodeEnd":9733,"githubUrl":"https://github.com/pbakaus/impeccable/blob/f2c7051853848826aac2f4646581d62a732155ad/skill/scripts/live-browser.js#L9697-L9733","documentation":"When a GENERATING session resumes (e.g. after a page reload), the client asynchronously re-captures the target element (or insert placeholder) to restart the shader overlay at the right coordinates. Any throw inside that async block — element gone after reload, capture failure of the same class as the main path — is logged as 'shader resume failed:' and swallowed; resume itself succeeds, only the overlay is missing.","triggerScenarios":"The target element was removed or replaced by SSR/hydration during reload so getBoundingClientRect or captureElementToBlob fails; the element is display:none giving a zero rect (that case returns silently); modern-screenshot failure on the reloaded DOM.","commonSituations":"Page reload mid-generation where the app renders a different DOM; hydration replacing the captured node; element hidden behind the overlay at resume time.","solutions":["Cosmetic only — wait for the generation result; the flow does not need the overlay","Re-trigger generate if the visual anchor matters on the reloaded page","If overlays routinely fail to resume, ensure the target element has a stable selector across reloads"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const rect = shaderTarget?.getBoundingClientRect();\nif (!shaderTarget?.isConnected || !rect || rect.width === 0 || rect.height === 0) return; // no overlay on resume","typeGuard":null,"tryCatchPattern":"try { const { blob, paper } = await captureElementToBlob(shaderTarget, null, rect); if (blob && state === 'GENERATING') showShaderOverlay(shaderTarget, blob, rect, paper); } catch (err) { console.warn('shader resume failed:', err); } // resume continues regardless","preventionTips":["Give generate targets stable selectors so they survive reload/hydration","Check isConnected and non-zero rect before re-capturing on resume","Never block the resumed session on overlay success — it is purely visual"],"tags":["resume","shader-overlay","capture","race-condition"],"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"}