{"record":{"id":"34d5a3c32fd26cab","repo":"pbakaus/impeccable","slug":"impeccable-could-not-find-original-element-in-li","errorCode":null,"errorMessage":"[impeccable] Could not find original element in live DOM.","messagePattern":"\\[impeccable\\] Could not find original element in live DOM\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"skill/scripts/live-browser.js","lineNumber":5832,"sourceCode":"        const remounted = await mountSvelteComponentVariant(visibleVariant || 1);\n        if (!remounted) {\n          // The mount already reported the failure and raised the card.\n          // Advancing to CYCLING here would show a bar claiming variants are\n          // ready over a page where nothing rendered.\n          saveSession();\n          return;\n        }\n        setLiveState('CYCLING');\n        hideShaderOverlay();\n        showOrUpdateCyclingBar();\n        saveSession();\n        completeParameterGenerationIfReady();\n        return;\n      }\n\n      const liveEl = findLiveElementForSvelteManifest(manifest);\n      if (!liveEl?.parentElement) {\n        console.warn('[impeccable] Could not find original element in live DOM.');\n        arrivedVariants = availableVariants;\n        expectedVariants = Number(manifest.count) || expectedVariants || arrivedVariants;\n        const saved = loadSession();\n        const savedVisibleVariant = saved && saved.id === sessionId ? saved.visible : 0;\n        visibleVariant = visibleVariant > 0 && visibleVariant <= arrivedVariants\n          ? visibleVariant\n          : (savedVisibleVariant > 0 && savedVisibleVariant <= arrivedVariants ? savedVisibleVariant : 1);\n        enterRecoveryWaitingForAnchor({ checkpointReason: 'component_preview_anchor_missing', trackScroll: true });\n        waitForSvelteComponentTargetAndRetry({ manifestPath, sessionId, manifest });\n        return;\n      }\n\n      const wrapper = document.createElement('div');\n      wrapper.dataset.impeccableVariants = sessionId;\n      wrapper.dataset.impeccableVariantCount = String(manifest.count || expectedVariants || 1);\n      wrapper.dataset.impeccablePreview = componentPreviewMode;\n      wrapper.style.display = 'contents';\n","sourceCodeStart":5814,"sourceCodeEnd":5850,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/skill/scripts/live-browser.js#L5814-L5850","documentation":"After a Svelte component-variant manifest is accepted, the script must find the original element the user picked in the live page DOM to swap it for the variants wrapper. When findLiveElementForSvelteManifest returns nothing (or the element has no parent), this warning fires and the session enters recovery: it keeps the variant counts, remembers the saved visible variant, and waits for the anchor to appear again rather than failing outright.","triggerScenarios":"Resuming or mounting Svelte component variants when the picked element is no longer in the DOM — a route change, conditional render (closed modal/panel), or framework re-render removed it between generation and mount.","commonSituations":"Page navigated to another route while variants were generating; element inside a conditionally rendered block that unmounted; full page refresh landed on a page where the element is not rendered; HMR replaced the component instance before mount.","solutions":["Navigate back to the route/view where the picked element is rendered — the session recovers automatically once the anchor appears.","Retrace the path that made the element visible (open the modal/panel, trigger the conditional).","If the element is permanently gone, discard the session and pick a new element.","Check the manifest's sourceFile/anchor metadata matches the page you are viewing."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":"const liveEl = findLiveElementForSvelteManifest(manifest);\nif (!liveEl?.parentElement) {\n  // enter recovery: keep counts, wait for anchor to reappear\n  enterRecoveryWaitingForAnchor({ checkpointReason: 'component_preview_anchor_missing', trackScroll: true });\n}","tryCatchPattern":null,"preventionTips":["Stay on the route/view containing the picked element until variants mount.","Keep conditionally rendered targets visible (open modal/panel) during generation.","After a refresh, retrace the path that revealed the element before waiting for recovery.","If the element was removed permanently, discard the session rather than waiting."],"tags":["browser","dom","svelte","recovery","session"],"backgroundTag":"dom-element-not-found","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}