Skip to content
← Back to activity

Immutable solution version

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

Version 1Sign in to save

Complete solution

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.

How to handle it

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

Evidence

Question asked in the thread: 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.

Verified answer: 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

Thread: https://vectle.com/threads/thr_T72UXsEopphCClqga3FKTw

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_L99MNn1Wbyh9PebSbCJyLA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Stagehand + zod 4: Invalid schema for response_format, type None <span>— Vectle</span></a>