{"record":{"id":"f9c9ff8554fb4fc9","repo":"pbakaus/impeccable","slug":"impeccable-scan-failed-f9c9ff","errorCode":null,"errorMessage":"[impeccable] scan failed","messagePattern":"\\[impeccable\\] scan failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"browser-bundle/50-scan.js","lineNumber":423,"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":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/browser-bundle/50-scan.js#L405-L441","documentation":"The Impeccable browser bundle wraps its automatic initial scan() call in a try/catch and logs '[impeccable] scan failed' via console.warn instead of throwing. It indicates the static/scan pass crashed at runtime (e.g. a DOM query or rule threw) while loading the page; auto-scan is best-effort and never breaks the page.","triggerScenarios":"autoScan is not disabled in window.__IMPECCABLE_CONFIG__ and the runAutoScan wrapper (scheduled 100ms after DOMContentLoaded, or 100ms after script eval if the DOM is already ready) invokes scan() and scan() throws.","commonSituations":"A page with unusual DOM (detached nodes, shadow DOM, non-standard APIs) causing a rule to throw; a broken or partially-loaded detector bundle interacting with page scripts that mutate the DOM during the scan; an older browser lacking APIs the scanner assumes.","solutions":["Read the accompanying error object in the console warn; it names the rule or line that threw","Set window.__IMPECCABLE_CONFIG__ = { autoScan: false } to disable the automatic scan if it is disruptive","Update the extension/bundle to the latest ENGINE_VERSION, as scan crashes are usually fixed in newer rule code","Reproduce with the page's scripts disabled to determine whether page mutations race the scan"],"exampleFix":"// before\nwindow.__IMPECCABLE_CONFIG__ = {};\n// after\nwindow.__IMPECCABLE_CONFIG__ = { autoScan: false }; // opt out of auto scan; call scan() manually","handlingStrategy":"try-catch","validationCode":"if (window.__IMPECCABLE_CONFIG__?.autoScan === false) { /* auto-scan disabled; skip */ }","typeGuard":"function canScan() { return typeof window.scan === 'function' && document.readyState !== 'loading'; }","tryCatchPattern":"try { scan(); } catch (err) { console.warn('[impeccable] scan failed', err); /* non-fatal: page continues */ }","preventionTips":["Keep the detector bundle at the pinned ENGINE_VERSION","Set autoScan:false in __IMPECCABLE_CONFIG__ when testing pages with hostile DOM mutations","Check the console on integration pages for warn output during rollout"],"tags":["browser","javascript","scan","console-warn"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}