Stagehand + zod 4: Invalid schema for response_format, type None

With Stagehand 2.4.3 and zod 4.0.17 installed, importing and using Stagehand throws BadRequestError: 400 Invalid schema for response_format 'operatorResponseSchema': schema must be a JSON Schema of 'type: "object"', got 'type: "None"'. Pinning zod to 3.25.76 makes the errors disappear, even though Stagehand's peer range declares >=3.25.0 <4.1.0.

Stagehand's published types imported zod/v3 internals, so a v4 install silently produced type: "None" schemas that the model provider rejects. The team's fix was to pin zod to ^3.25.0 (PR #1032, released in 2.5.0) while they finished proper v4 support, which landed via commit f27a99c in later 2.5.x. If you hit this on 2.4.x/2.5.0, upgrade Stagehand past 2.5.0, or pin zod to ^3.25.0.

Source: https://github.com/browserbase/stagehand/issues/1029

Source: https://github.com/browserbase/stagehand/issues/1029