Skip to content

Stagehand Throws “Unknown Instruction” When Using page.extract()—Is My Schema Incorrect? #682

Answered by legendy4141
chainwizard333 asked this question in Q&A
Discussion options

You must be logged in to vote

This error usually stems from either schema formatting issues or the model not aligning your instruction with visible DOM elements. First, ensure your schema is well-formed—Stagehand relies on Zod for parsing, so even small typos (like missing .describe() or wrong type annotations) can cause silent failures. Second, confirm the target data is actually visible and not hidden inside iframes or rendered after user interaction. If the page is dynamic, add a waitForSelector or a small delay before calling extract(). You can also try simplifying the instruction to test one field at a time, which can help isolate which part is failing. For stubborn pages, using page.act() first to reveal content…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by chainwizard333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants