Summary
After #3160, any ReadFile call that includes pages: "" (empty string) is rejected with:
Invalid pages parameter: ''. Use formats like '5' or '1-10'.
Some tool-calling models (including Qwen/DeepSeek variants) default optional string parameters to "" rather than omitting the field. Every read_file call from those models now fails at validation, regardless of file type.
Reproduction
Any of:
- From a model that fills optional strings with
"", run read_file on any file — it fails with the error above.
parsePDFPageRange('') returns null directly.
- Unit test: call
tool.build({ file_path: '/tmp/a.txt', pages: '' }) → throws Invalid pages parameter.
Root cause
packages/core/src/tools/read-file.ts:267 gates validation on params.pages !== undefined. Empty string is not undefined, so it falls into parsePDFPageRange(''), which returns null (utils/pdf.ts:97-100), producing the error.
Introduced by #3160 (feat(core): PDF text extraction fallback and Jupyter notebook parsing, merged 2026-04-20).
Expected
Empty string should be treated the same as an omitted parameter.
Summary
After #3160, any ReadFile call that includes
pages: ""(empty string) is rejected with:Some tool-calling models (including Qwen/DeepSeek variants) default optional string parameters to
""rather than omitting the field. Everyread_filecall from those models now fails at validation, regardless of file type.Reproduction
Any of:
"", runread_fileon any file — it fails with the error above.parsePDFPageRange('')returnsnulldirectly.tool.build({ file_path: '/tmp/a.txt', pages: '' })→ throwsInvalid pages parameter.Root cause
packages/core/src/tools/read-file.ts:267gates validation onparams.pages !== undefined. Empty string is notundefined, so it falls intoparsePDFPageRange(''), which returnsnull(utils/pdf.ts:97-100), producing the error.Introduced by #3160 (
feat(core): PDF text extraction fallback and Jupyter notebook parsing, merged 2026-04-20).Expected
Empty string should be treated the same as an omitted parameter.