{"record":{"id":"f58c0925fd7de2fd","repo":"mastra-ai/mastra","slug":"mouse-event-injection-not-supported-by-this-provid","errorCode":null,"errorMessage":"Mouse event injection not supported by this provider","messagePattern":"Mouse event injection not supported by this provider","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/browser/browser.ts","lineNumber":1503,"sourceCode":"        `[MastraBrowser] startScreencastIfBrowserActive: hasThreadSession(${threadId})=false, scope=${scope}`,\n      );\n      return null;\n    }\n\n    return this.startScreencast(mergedOptions);\n  }\n\n  // ---------------------------------------------------------------------------\n  // Event Injection (optional - for Studio live view)\n  // ---------------------------------------------------------------------------\n\n  /**\n   * Inject a mouse event. Override in subclass if supported.\n   * @param event - Mouse event parameters\n   * @param threadId - Optional thread ID for thread-isolated sessions\n   */\n  async injectMouseEvent(_event: MouseEventParams, _threadId?: string): Promise<void> {\n    throw new Error('Mouse event injection not supported by this provider');\n  }\n\n  /**\n   * Inject a keyboard event. Override in subclass if supported.\n   * @param event - Keyboard event parameters\n   * @param threadId - Optional thread ID for thread-isolated sessions\n   */\n  async injectKeyboardEvent(_event: KeyboardEventParams, _threadId?: string): Promise<void> {\n    throw new Error('Keyboard event injection not supported by this provider');\n  }\n\n  // ---------------------------------------------------------------------------\n  // Abstract Methods (providers must implement)\n  // ---------------------------------------------------------------------------\n\n  /**\n   * Get the active page for a thread.\n   * Used by screencast reconnection to emit the current URL.","sourceCodeStart":1485,"sourceCodeEnd":1521,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/browser/browser.ts#L1485-L1521","documentation":"injectMouseEvent is a base-class stub that providers override when they can inject pointer input (e.g. via CDP Input.dispatchMouseEvent). The default implementation always throws, advertising the provider's lack of input-injection support.","triggerScenarios":"Calling browser.injectMouseEvent(event, threadId?) on a provider that has not overridden the method.","commonSituations":"Simulating user clicks in an agent loop against a provider without input injection; replaying recorded interaction traces across providers with different capability sets.","solutions":["Use a provider that implements injectMouseEvent.","Feature-detect capability before calling and degrade (e.g. use playwright page.mouse directly if the session object is exposed).","Implement the override in a custom provider.","Model the interaction via higher-level automation APIs the provider does support."],"exampleFix":"// before\nawait browser.injectMouseEvent({ type: 'mousePressed', x: 10, y: 10 });\n// after\nconst cdp = await browser.getPage(sessionId);\nawait cdp.send('Input.dispatchMouseEvent', { type: 'mousePressed', x: 10, y: 10 });","handlingStrategy":"validation","validationCode":"if (browser.injectMouseEvent === MastraBrowser.prototype.injectMouseEvent) {\n  throw new Error(`Provider ${browser.provider} cannot inject mouse events`);\n}","typeGuard":"function supportsMouseInput(b: object): boolean {\n  return b.injectMouseEvent !== MastraBrowser.prototype.injectMouseEvent;\n}","tryCatchPattern":"try {\n  await browser.injectMouseEvent(ev, threadId);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Mouse event injection not supported')) {\n    await fallbackClick(page, ev); // e.g. DOM-level click via page handle\n  } else throw err;\n}","preventionTips":["Gate interaction-recording features on provider capability.","Compare against the base prototype instead of try/catch in hot paths.","Keep input simulation on providers known to implement CDP Input domains.","Test provider swaps with a capability smoke test."],"tags":["input","unsupported-operation","provider-capability"],"backgroundTag":"unsupported-provider-operation","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}