ai-sdk-provider icon indicating copy to clipboard operation
ai-sdk-provider copied to clipboard

Haiku 4.5 throws schema validation errors when files attached

Open mbektimirov opened this issue 1 month ago • 1 comments

It works time to time, but most requests to anthropic/claude-haiku-4.5 with attached pdf are returning this error:

Error message: [{"code":"invalid_union","errors":[[{"code":"invalid_union","errors":[[{"code":"invalid_value","values":["url_citation"],"path":["type"],"message":"Invalid input: expected \"url_citation\""},{"expected":"object","code":"invalid_type","path":["url_citation"],"message":"Invalid input: expected object, received undefined"}],[{"code":"invalid_value","values":["file_annotation"],"path":["type"],"message":"Invalid input: expected \"file_annotation\""},{"expected":"object","code":"invalid_type","path":["file_annotation"],"message":"Invalid input: expected object, received undefined"}],[{"expected":"string","code":"invalid_type","path":["file","content",13,"text"],"message":"Invalid input: expected string, received undefined"}]],"path":["choices",0,"delta","annotations",0],"message":"Invalid input"}],[{"expected":"object","code":"invalid_type","path":["error"],"message":"Invalid input: expected object, received undefined"}]],"path":[],"message":"Invalid input"}]] 

When it passes through though it reports that pdf file is corrupted. It's a 1.2 mb pdf file.

This PDF file is a corrupted or malformed document containing what appears to be:

Italian administrative/bureaucratic data
Multiple tables with Italian text including:

"PROVVISORIA" (Provisional)
"COLLABORATORE SCOLASTICO" (School Collaborator)
School/education institution codes (TOIC8B8007, etc.)
Dates from 2014-2018
Japanese government procedure documentation
Sections with Japanese text describing:

Government ministry procedures (国家公安委員会 - National Public Safety Commission)
Nuclear material regulations
Official administrative processes
Massive amounts of corrupted/garbled data including:

Repeated strings of numbers (1s and 0s)
Placeholder text
Malformed table structures
Broken formatting

mbektimirov avatar Nov 24 '25 15:11 mbektimirov

@mbektimirov that should be fixed i have latest version sdk + plugin pdf parser and it working for me no issues

ldriss avatar Nov 25 '25 22:11 ldriss

Closing as resolved in v1.4.0

subtleGradient avatar Dec 06 '25 09:12 subtleGradient