stagehand
stagehand copied to clipboard
Error: Invalid schema for function 'json': schema must be a JSON Schema of 'type: "object"', got 'type: "None"'.
Before submitting an issue, please:
- [x] Check the documentation for relevant information
- [x] Search existing issues to avoid duplicates
Environment Information
Please provide the following information to help us reproduce and resolve your issue:
Stagehand:
- Typescript
- Stagehand version: 2.5.2
AI Provider:
- Provider: OpenAI / Gemini
- Model: Default / google/gemini-2.5-computer-use-preview-10-2025 google/gemini-2.5-computer-use-preview-10-2025
Issue Description
I get the error: "Invalid schema for function 'json': schema must be a JSON Schema of 'type: "object"', got 'type: "None"'."
Steps to Reproduce
- New Repo
- Use Code
const stagehand = new Stagehand({
env: 'LOCAL',
// modelName: 'google/gemini-2.5-computer-use-preview-10-2025',
// modelClientOptions: {
// apiKey: env.GEMINI_API_KEY,
// },
});
await stagehand.init();
const page = stagehand.page;
await page.goto('https://github.com/browserbase');
await page.act('click on the stagehand repo link');
Minimal Reproduction Code
// Your minimal reproduction code here
import { Stagehand } from '@browserbase/stagehand';
const stagehand = new Stagehand({
env: 'LOCAL'
});
await stagehand.init();
const page = stagehand.page;
await page.goto('https://github.com/browserbase');
await page.act('click on the stagehand repo link');
Error Messages / Log trace
StagehandDefaultError:
Hey! We're sorry you ran into an error.
Stagehand version: 2.5.2
If you need help, please open a Github issue or reach out to us on Slack: https://stagehand.dev/slack
Full error:
Invalid schema for function 'json': schema must be a JSON Schema of 'type: "object"', got 'type: "None"'.
at _StagehandPage.<anonymous> (/Users/j/Code/@j/DRS/node_modules/.bun/@[email protected]+3a7d84e035fa9623/node_modules/@browserbasehq/stagehand/dist/index.js:4402:15)
at Generator.throw (<anonymous>)
at rejected (/Users/j/Code/@j/DRS/node_modules/.bun/@[email protected]+3a7d84e035fa9623/node_modules/@browserbasehq/stagehand/dist/index.js:73:29)
This is due to me using v4, even though I was using zod/v3 as an import. So I don't think you can use v4 in general.
@j Did you override this in package.json or downgrade zod in your project.
going to close this one as support for zod 4 was added here and is currently available on the latest alpha release of stagehand