{"record":{"id":"ba6c9840c9661b07","repo":"pbakaus/impeccable","slug":"impeccable-scan-failed-ba6c98","errorCode":null,"errorMessage":"[impeccable] scan failed","messagePattern":"\\[impeccable\\] scan failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/live/assets/detect-antipatterns-browser.js","lineNumber":3813,"sourceCode":"      if (e.data.action === 'remove') {\n        clearOverlays();\n        ui.remove();\n      }\n      if (e.data.action === 'highlight') {\n        ui.highlightSelector(e.data.selector);\n      }\n      if (e.data.action === 'unhighlight') {\n        ui.unspotlight();\n      }\n    });\n    window.postMessage({ source: 'impeccable-ready' }, '*');\n  } else {\n    if (window.__IMPECCABLE_CONFIG__?.autoScan !== false) {\n      const runAutoScan = () => {\n        try {\n          scan();\n        } catch (err) {\n          console.warn('[impeccable] scan failed', err);\n        }\n      };\n      if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', () => setTimeout(runAutoScan, 100));\n      } else {\n        setTimeout(runAutoScan, 100);\n      }\n    }\n  }\n\n  window.impeccableDetect = detect;\n  window.impeccableDetectAsync = detectAsync;\n  window.impeccableScan = scan;\n  window.impeccableScanAsync = scanAsync;\n  // Raw measurement for the URL engine's content-hidden-at-rest pass: it\n  // drives a reveal sweep from Node and thresholds the result itself.\n  window.impeccableMeasureHiddenText = () => JSON.parse(__impeccable.measure_hidden_text());\n  window.impeccableCollectVisualContrastCandidates = collectVisualContrastCandidates;","sourceCodeStart":3795,"sourceCodeEnd":3831,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/live/assets/detect-antipatterns-browser.js#L3795-L3831","documentation":"Warning emitted when the automatic impeccable scan throws at startup. The auto-scan runs 100ms after DOMContentLoaded (or page load if already loaded) and catches any synchronous error so a broken page never breaks the host site. The scan produces no or partial results.","triggerScenarios":"window.__IMPECCABLE_CONFIG__.autoScan is not false and the injected scan() throws synchronously during the deferred auto-run (DOM mutation during scan, unsupported selectors, or an engine/rule bug).","commonSituations":"Pages with unusual DOM (huge tables, broken custom elements), conflicts with other extensions injecting scripts, or a stale/mismatched detector bundle.","solutions":["Inspect the logged err object for the root cause.","Set window.__IMPECCABLE_CONFIG__ = { autoScan: false } before the script loads to disable auto-scan, then trigger scans manually.","Rebuild/refresh the detector bundle (cargo xtask bundle) if the asset is stale, and verify the page in a clean profile."],"exampleFix":"// before (fail at startup, page breaks)\nscan();\n// after (guarded auto-scan)\ntry { scan(); } catch (err) { console.warn('[impeccable] scan failed', err); }","handlingStrategy":"try-catch","validationCode":"if (window.__IMPECCABLE_CONFIG__?.autoScan === false) return; // auto-scan disabled by page\n","typeGuard":"function scanable() { return typeof window.scan === 'function' && document.readyState !== 'loading'; }","tryCatchPattern":"const runAutoScan = () => {\n  try { scan(); } catch (err) { console.warn('[impeccable] scan failed', err); }\n};\ndocument.readyState === 'loading'\n  ? document.addEventListener('DOMContentLoaded', () => setTimeout(runAutoScan, 100))\n  : setTimeout(runAutoScan, 100);","preventionTips":["Always wrap auto-init scripts in try/catch so host pages never break.","Defer scanning ~100ms past DOMContentLoaded, as the bundle does, to avoid half-built DOM.","Test the injected script on hostile pages (heavy frameworks, other extensions) before release."],"tags":["scan","browser","auto-scan","dom"],"backgroundTag":"scan-failed","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"}