Uploading short .txt file error: "Extracted content contained only whitespace"

When uploading a short .txt file to my assistant, I’m getting the following error:

Failed to index file: Error extracting text from file [...] detail_str=', detail: Extracted content contained only whitespace.' self.error_code=<FileParsingErrorCode.EMPTY_FILE: 'file_empty'> self.m...

The file is called “temp.txt” and contains only a single line which is the word “hi”. When I add more than 5 characters, the upload is successful. For example “hello” doesn’t work, but “hellot” uploads successfully.
Our application would like to allow users to upload files of any size. Is there a workaround for this other than detecting small file sizes manually?

Maybe check file size or add something 5 characters long to all uploaded texts?

The only issue here is then categorizing files into plaintext vs. other formats, such as pdf, which we wouldn’t want to mess with. But that could be viable.

Might be another way to check for an empty PDF? Not sure why they would upload it, but good to think about edge cases.

1 Like