{"record":{"id":"d9643fd5b1ac38e4","repo":"CloakHQ/CloakBrowser","slug":"isolated-world-dom-evaluation-failed-for-selecto-d9643f","errorCode":null,"errorMessage":"Isolated-world DOM evaluation failed for '{selector}'","messagePattern":"Isolated-world DOM evaluation failed for '(.+?)'","errorType":"exception","errorClass":"StealthEvaluationError","httpStatus":null,"severity":"error","filePath":"dotnet/src/CloakBrowser/Human/Actionability.cs","lineNumber":168,"sourceCode":"\n        while (true)\n        {\n            double remainingMs = Math.Max(0, deadline - NowMs());\n            if (remainingMs <= 0)\n            {\n                if (lastError != null)\n                    throw lastError;\n                throw new ActionabilityError(selector, \"timeout\", \"timeout expired before first check\");\n            }\n\n            try\n            {\n                var (status, snapshot) = await StealthDom.ActionableAsync(\n                    stealth, selector).ConfigureAwait(false);\n                if (status == StealthStatus.Unsupported)\n                    throw new UnsupportedHumanizeSelectorError(selector);\n                if (status == StealthStatus.EvaluationFailed)\n                    throw new StealthEvaluationError(selector);\n                if (status == StealthStatus.NotFound)\n                    throw new ElementNotAttachedError(selector);\n                if (status != StealthStatus.Ok || snapshot == null)\n                    throw new StealthEvaluationError(selector);\n\n                var value = snapshot.Value;\n                if (checks.Contains(\"visible\") && !value.Visible)\n                    throw new ElementNotVisibleError(selector);\n                if (checks.Contains(\"enabled\") && !value.Enabled)\n                    throw new ElementNotEnabledError(selector);\n                if (checks.Contains(\"editable\") && !value.Editable)\n                    throw new ElementNotEditableError(selector);\n                return;\n            }\n            catch (Exception error) when (error is ActionabilityError or StealthEvaluationError)\n            {\n                lastError = error;\n                if (NowMs() >= deadline)","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/CloakHQ/CloakBrowser/blob/d6bad5de261bedf025280ace1d14e800aee13923/dotnet/src/CloakBrowser/Human/Actionability.cs#L150-L186","documentation":"The isolated-world DOM evaluation itself failed (StealthStatus.EvaluationFailed, or an Ok status with a null snapshot), so the actionability check could not read element state. This is an infrastructure failure of the stealth CDP evaluation, not a verdict about the element. When it happens on the first attempt inside the window it may be recorded and retried until timeout.","triggerScenarios":"Calling EnsureActionableAsync when StealthDom.ActionableAsync throws or returns a failed status — CDP Runtime.evaluate errors, the isolated world's execution context destroyed by navigation or frame swap, JS exception inside the injected evaluator, or snapshot deserialization returning null.","commonSituations":"Page navigation or SPA soft-navigation destroying the execution context mid-check; frame attachment races; the injected script crashing on unusual DOM shapes; DevTools protocol version mismatches after a Chromium upgrade; world handle invalidated by page reload.","solutions":["Retry the call — transient context destruction (navigation races) commonly resolves on retry.","Re-acquire the IsolatedWorld after navigation or frame changes before humanizing.","Ensure the page has finished navigating (wait for load/network idle) before checks.","If persistent, update the library to match your Chromium version (protocol/evaluator drift)."],"exampleFix":"// before\nawait Actionability.EnsureActionableWorldAsync(page, selector, stealth);\n\n// after\nawait page.WaitForLoadStateAsync(LifecycleEvent.NetworkIdle);\nstealth = await page.AcquireIsolatedWorldAsync(); // refresh context after nav\nawait Actionability.EnsureActionableWorldAsync(page, selector, stealth);","handlingStrategy":"retry","validationCode":"if (stealth is { IsClosed: false } w && await w.IsContextAliveAsync())\n    await Actionability.EnsureActionableAsync(page, selector, w);","typeGuard":null,"tryCatchPattern":"catch (StealthEvaluationError)\n{\n    await page.WaitForLoadStateAsync(LifecycleEvent.Load);\n    stealth = await page.AcquireIsolatedWorldAsync(); // fresh context after nav\n    await Actionability.EnsureActionableAsync(page, selector, stealth);\n}","preventionTips":["Re-acquire the isolated world after every navigation/frame swap.","Wait for load/network-idle before actionability checks.","Keep the library and Chromium versions in lockstep to avoid CDP/evaluator drift."],"tags":["stealth","cdp","evaluation","isolated-world","dom"],"backgroundTag":"dom-evaluation-context-failed","analyzedSha":"d6bad5de261bedf025280ace1d14e800aee13923","analyzedAt":"2026-08-28T14:13:12.918Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}