-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Description
Description
When web_fetch is called on a PDF, I get this validation error:
Error message: [ { "code": "invalid_union", "errors": [ [ { "code": "invalid_value", "values": [ "text" ], "path": [ "content", "source", "type" ], "message": "Invalid input: expected \"text\"" } ], [ { "code": "invalid_value", "values": [ "web_fetch_tool_result_error" ], "path": [ "type" ], "message": "Invalid input: expected \"web_fetch_tool_result_error\"" }, { "expected": "string", "code": "invalid_type", "path": [ "error_code" ], "message": "Invalid input: expected string, received undefined" } ] ], "path": [ "content_block", "content" ], "message": "Invalid input" } ]
The full message appears to be valid (according to https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool), pasted below with the PDF content elided for brevity.
Type validation failed: Value: {"type":"content_block_start","index":10,"content_block":{"type":"web_fetch_tool_result","tool_use_id":"srvtoolu_01J56AdRLf4MjaHUq6CLqKAA","content":{"type":"web_fetch_result","url":"https://assets.unilogcorp.com/187/ITEM/DOC/Simpson_Strong_Tie_101860392_Specification_Sheet.pdf","retrieved_at":"2025-12-09T22:40:10.654602","content":{"type":"document","source":{"type":"base64","media_type":"application/pdf","data":"JVBERi0xLjcNJeLjz9MNC..."},"title":null}}}}. Error message: [ { "code": "invalid_union", "errors": [ [ { "code": "invalid_value", "values": [ "text" ], "path": [ "content", "source", "type" ], "message": "Invalid input: expected \"text\"" } ], [ { "code": "invalid_value", "values": [ "web_fetch_tool_result_error" ], "path": [ "type" ], "message": "Invalid input: expected \"web_fetch_tool_result_error\"" }, { "expected": "string", "code": "invalid_type", "path": [ "error_code" ], "message": "Invalid input: expected string, received undefined" } ] ], "path": [ "content_block", "content" ], "message": "Invalid input" } ]
AI SDK Version
"@ai-sdk/anthropic": "^3.0.0-beta.77",
"@ai-sdk/google": "^3.0.0-beta.66",
"@ai-sdk/openai": "^3.0.0-beta.88",
"ai": "^6.0.0-beta.138",
Code of Conduct
- I agree to follow this project's Code of Conduct