{"record":{"id":"254ef17ebaf85771","repo":"vercel-labs/agent-browser","slug":"accessibility-audit-world-has-a-locked-axe-propert","errorCode":null,"errorMessage":"Accessibility audit world has a locked axe property","messagePattern":"Accessibility audit world has a locked axe property","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/native/a11y/mod.rs","lineNumber":45,"sourceCode":"    tags.map(|tags| {\n        tags.split(',')\n            .map(str::trim)\n            .filter(|tag| !tag.is_empty())\n            .collect()\n    })\n    .unwrap_or_default()\n}\n\nfn private_engine_setup() -> String {\n    format!(\n        r#\"const previousAxe = Object.getOwnPropertyDescriptor(window, 'axe');\n  let agentAxe;\n  try {{\n    // This runs in an isolated world, never the page's JavaScript world. Guard\n    // the world-local descriptor anyway so axe's UMD assignment cannot invoke\n    // an accessor if another audit helper reused this world name.\n    if (previousAxe && !previousAxe.configurable) {{\n      throw new Error('Accessibility audit world has a locked axe property');\n    }}\n    Object.defineProperty(window, 'axe', {{\n      value: undefined,\n      writable: true,\n      enumerable: previousAxe ? previousAxe.enumerable : false,\n      configurable: true,\n    }});\n    // The vendored UMD build exports through this lexical CommonJS module.\n    // Hide world-local AMD loaders so evaluating axe cannot register modules\n    // outside the private CommonJS export.\n    const module = {{ exports: {{}} }};\n    const define = undefined;\n    {axe_js}\n    agentAxe = module.exports;\n  }} finally {{\n    // axe-core also assigns window.axe in browsers. Restore this isolated world\n    // exactly after capturing our private export.\n    if (previousAxe) {{","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/vercel-labs/agent-browser/blob/548b159b30eef119ccf6846c8bc807d0eaa3f6f8/cli/src/native/a11y/mod.rs#L27-L63","documentation":"Thrown by the JavaScript prelude that agent-browser injects into its private isolated world (named __agent_browser_a11y_4_12_1__, one per frame) before evaluating the vendored axe-core 4.12.1 build. The prelude captures the world-local descriptor of window.axe; if a previous script in that same named world already defined 'axe' as non-configurable, redefining it would throw or invoke a foreign accessor, so the audit aborts instead of corrupting the capture. It reaches the CLI user as an 'Evaluation error: ...' from the a11y command.","triggerScenarios":"Running 'agent-browser a11y' on a frame where another audit helper (browser extension, user-injected script, tooling that reuses the world name) has left a non-configurable window.axe in the isolated world; repeated audits on a long-lived frame after an earlier audit crashed mid-setup and left a locked descriptor.","commonSituations":"Mixing agent-browser a11y audits with other axe-based tooling attached to the same Chrome instance; very long-lived sessions that survived many navigations-less audits; running an older agent-browser side by side with a newer one whose world names collide.","solutions":["Re-navigate the page (e.g. 'agent-browser open <url>') — navigation destroys the frame's isolated worlds, so the next audit gets a clean world","Restart the browser session: 'agent-browser close' then relaunch with 'agent-browser open'","Upgrade agent-browser — the world name embeds the axe version (__agent_browser_a11y_4_12_1__), so a version bump gets a fresh world name","Stop injecting other axe-core scripts into agent-browser's __agent_browser_a11y_*__ isolated worlds"],"exampleFix":"// before\nagent-browser a11y --session stale   # Evaluation error: ... locked axe property\n\n// after\nagent-browser close --session stale\nagent-browser open https://app --session stale\nagent-browser a11y --session stale","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// In your orchestration code (running the CLI):\n// try { run a11y } catch (err) {\n//   if (String(err).includes('locked axe property')) {\n//     re-navigate or restart the session, then retry the audit once;\n//   } else throw;\n// }","preventionTips":["Do not inject other axe-core builds or freeze globals into agent-browser's __agent_browser_a11y_*__ isolated worlds","Re-navigate before auditing when a session has been reused for many audits","Keep agent-browser updated so the versioned world name changes with axe upgrades"],"tags":["a11y","axe-core","cdp","isolated-world","browser"],"backgroundTag":null,"analyzedSha":"548b159b30eef119ccf6846c8bc807d0eaa3f6f8","analyzedAt":"2026-08-16T10:12:14.925Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}