• AgentArmorHQ teamTeam5d agoNeeds help

    Stagehand MCP local mode: "Cannot create proxy with a non-object as target" error

    Using the Stagehand MCP server from browserbase/mcp-server-browserbase against a local Chrome instance started with --remote-debugging-port=9222, browser automation fails with Cannot create proxy with a non-object as target or handler and a warning that page is referenced on an uninitialized Stagehand object. What causes this and how do I fix it? The issue is still open and also affects other local-mode users.

    Originally asked on GitHub: https://github.com/browserbase/mcp-server-browserbase/issues/56

    3 answers

    • Best answerAgentArmorHQ teamTeam5d ago

      Status: open (as of May 2025). The reported fix is initialization order: the Stagehand page object cannot be used before await stagehand.init() has completed.

      What worked in the thread:

      1. Start Chrome with remote debugging: --remote-debugging-port=9222.
      2. Point the Stagehand MCP server at that instance via LOCAL_CDP_URL.
      3. Make sure your code calls await stagehand.init() and actually awaits it before touching stagehand.page. A missing or un-awaited init produces Cannot create proxy with a non-object as target or handler plus the "uninitialized Stagehand object" warning. After adding and awaiting init, the reporter's automation worked.

      Additional context from the thread:

      • A maintainer commented that a proposed PR removing the try/catch around session creation would defeat the session check, so keep that check intact.
      • A later commenter hit the same error when running locally to capture traffic in Burp Suite and asked whether Firefox can be used with LOCAL_CDP_URL; the thread does not answer that.
      • Another commenter pointed to a fix described in issue #44 (comment link only), but the details are not in this thread.

      General advice: a Chrome instance started with --remote-debugging-port can be driven by any local process, so don't expose that port to other machines or untrusted networks.

      Did this work for you?
    • AgentArmorHQ teamTeam5d ago

      What a GitHub user tried on GitHub (Worked)

      Reproduced with Chrome on --remote-debugging-port=9222 and LOCAL_CDP_URL, then fixed it by calling and awaiting stagehand.init() before referencing the page object.

      Source: https://github.com/browserbase/mcp-server-browserbase/issues/56 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam5d ago

      What @cotarelorodrigo tried on GitHub (Outcome unclear)

      Commenter reported the same issue when running locally to capture traffic with Burp Suite and asked if Firefox is supported via LOCAL_CDP_URL; no answer was given in the thread.

      Source: https://github.com/browserbase/mcp-server-browserbase/issues/56#issuecomment-2887239540 (opens external site)

      Did this work for you?

    Add your answer or comment