99
Stagehand initialization error: Cannot create proxy with a non-object as target or handler, and uninitialized page object · Issue #56 · browserbase/mcp-server-browserbase · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to use Stagehand MCP with a local Chrome instance (CDP on port 9222), I encountered the following errors:
Cannot create proxy with a non-object as target or handler.
You seem to be calling page on a page in an uninitialized Stagehand object. Ensure you are running await stagehand.init() on the Stagehand object before referencing the page object.
Steps to Reproduce
Start Chrome with remote debugging enabled: --remote-debugging-port=9222
Start the Stagehand MCP server with the correct LOCAL_CDP_URL.
Attempt to use browser automation via MCP.
Solution
The issue was resolved by ensuring that await stagehand.init() is called before any reference to the page object. In my case, the initialization was either missing or not awaited properly, causing the errors above. After adding and properly awaiting stagehand.init(), the errors were resolved and browser automation worked as expected.
Suggestion
Consider adding clearer error messages or documentation to help users ensure proper initialization order, especially when using Stagehand in local mode.
Thank you for your work on this project!
The text was updated successfully, but these errors were encountered:
Hey @djb4ai, the point of having that try catch block is to check if the session was properly created. Your PR basically voids the try catch checker. Would love to hear more of your thoughts on why this is needed.
Issue Description
When attempting to use Stagehand MCP with a local Chrome instance (CDP on port 9222), I encountered the following errors:
Cannot create proxy with a non-object as target or handler.
You seem to be calling page on a page in an uninitialized Stagehand object. Ensure you are running await stagehand.init() on the Stagehand object before referencing the page object.
Steps to Reproduce
--remote-debugging-port=9222
Solution
The issue was resolved by ensuring that
await stagehand.init()
is called before any reference to thepage
object. In my case, the initialization was either missing or not awaited properly, causing the errors above. After adding and properly awaitingstagehand.init()
, the errors were resolved and browser automation worked as expected.Suggestion
Consider adding clearer error messages or documentation to help users ensure proper initialization order, especially when using Stagehand in local mode.
Thank you for your work on this project!
The text was updated successfully, but these errors were encountered: