Failure Detectors
What LOKI monitors and records as a failure during a chaos session.
Built-in detectors
Every chaos session attaches a suite of passive detectors to the Playwright page (attach, after_navigation, and inspect hooks) to capture runtime anomalies without requiring manual assertions:
| Flag | Type | Default | Description |
|---|---|---|---|
| JavaScriptErrorDetector | runtime | always on | Captures uncaught JS exceptions (pageerror), console.error messages, and unhandled Promise rejections (unhandledrejection). |
| NetworkDetector | network | always on | Records aborted/failed requests (requestfailed: CORS blocks, dropped connections, dead endpoints) and HTTP 4xx / 5xx responses. |
| DialogDetector | dialog | always on | Intercepts unexpected native alert, confirm, and prompt dialogs, logs them, and automatically dismisses them so the session never hangs. |
| NavigationDetector | navigation | always on | Detects browser-level error pages (chrome-error://, about:neterror, about:crash) and application error screens/routes (/500, /404, /error, /crash, or error titles). |
| ResourceDetector | assets | always on | Captures sub-resources (<img>, <script>, <link>) that fail to load during the session and <img> elements in the final DOM with naturalWidth === 0. |
| MobileLayoutDetector | layout | --device | Active when emulating a mobile device (--device). Checks for horizontal scroll overflow (scrollWidth > viewportWidth + 5) and missing or invalid <meta name="viewport"> tags. |
| UiFreezeDetector | ui-freeze | api-chaos | Active when API faults are injected (network-tormentor, swarm, all). Detects blank screens (white_screen), stuck loading spinners (infinite_spinner), and unmounted root containers (#root, #app, #__next). |
